public static Entities.Products MapProduct(YourStore.Library.Product p) { return(new Entities.Products { Id = p.ID, Cost = p.Cost, ProudctName = p.Name, ImagePath = p.imageLoc, }); }
/// <summary> /// Creating a Inventory for a store in db if needed /// </summary> /// <param name="q"></param> /// <param name="inv"></param> /// <param name="stores"></param> /// <returns></returns> public static Entities.Inventories MapInven(int q, YourStore.Library.Product p, Store stores)//old code { return(new Entities.Inventories { Quantity = q, Product = MapProduct(p), Store = MapStore(stores), }); }
public static YourStore.Library.Store MapStore(Entities.Stores st) { YourStore.Library.Store store = new Store(); store.Name = st.StoreName; store.StoreID = st.Id; store.Zip = st.Zip; YourStore.Library.Product products = new YourStore.Library.Product(); foreach (Entities.Inventories inven in st.Inventories) { products = Mapper.MapProduct(inven.Product); store.ItemInventory.Add(products, inven.Quantity); } return(store); }