I am writting a module where i am creating a rate for a list of product, and the rate for the product are assigned to different Store.
The rate can be created in a group of Store, with Multiple Store, and Individual Store.
As shown in the image Below.
a. Group of Store
A Store group is selected from the list of group. The list of product are displayed where we set the rate for the products, the rate of the products will be tagged to Store which are tagged in the group
b. Multiple Store
The multiple store can be selected from the list and the rate are added to the store.
c. Individual Store
The rate for the product are assigned to a individual branch.
Enitity for Product Rate
public class ProductRate
{
public decimal Price { get; set; }
public decimal MRP { get; set; }
public int ProductId { get; set; }
public int StoreId { get; set; }
[ForeignKey("StoreId")]
public virtual Store Store { get; set; }
[ForeignKey("ProductId")]
public virtual Product Product { get; set; }
public bool IsApproved { get; set; }
}
Currently my implementation looks as following:
public void CreateRateForIndividualStore(RateIndividualStoreViewModel model)
{
//Saving the rate of product
// Maintaining history of the product rate in ProductRateHistory table
}
public List<string> RateForMultipleStore(RateMultipleStoreViewModel model)
{
//Saving the rate of product
// Maintaining history of the product rate in ProductRateHistory table
}
public List<string> CreateRateByGroup(RateStoreGroupViewModel model)
{
}
Currently i am doing with the separate configuration for all three types.
ProductRateHistory table is the exact the same duplicate of the entity Product History.
Is there a more generic way for doing this task? Any pre-defined design pattern or methods?
Aucun commentaire:
Enregistrer un commentaire