public static Models.Store Map(DataAccess.Store store) => new Models.Store { Id = store.Id, Address = store.Address, State = store.State, Orders = Map(store.Orders).ToList(), Ingredients = Map(store.Ingredients).ToList() };
public static Library.Store Map(DataAccess.Store store) => new Library.Store { storeID = store.StoreId, sAddressLine1 = store.SaddressLine1, sAddressLine2 = store.SaddressLine2, sCity = store.Scity, sState = store.Sstate, sZipCode = store.Szipcode };
public void Insert(Store entity) { using (var context = new DataAccess.SuperZapatosContext()) { var store = new DataAccess.Store() { Address = entity.Address, Id = entity.Id, Name = entity.Name }; context.Stores.Add(store); context.SaveChanges(); } }
public void AddIngredients(Models.Ingredients ingredients, Models.Store store) { if (store != null) { // get the db's version of that restaurant // (can't use Find with Include) DataAccess.Store contextStore = _db.Store.Include(r => r.Ingredients) .First(r => r.Id == store.Id); store.Ingredients.Add(ingredients); contextStore.Ingredients.Add(Map(ingredients)); } else { _db.Add(Map(ingredients)); } }