//Add a location public void AddLocation(StoreLocation storeLocation) { if (storeLocation.Id != 0) { //Identity insert will not allow us to change the Id s_logger.Warn($"Location to be added has an ID ({storeLocation.Id}) already: ignoring."); } s_logger.Info($"Adding location"); StoreLocation entity = Mapper.MapStoreLocationWithOrdersAndProduct(storeLocation); entity.Id = 0; _dbContext.Add(entity); }
public void AddCustomertoDB(string fn, string ln, string phone) { using (var context = new Project1Context(Options)) { var _tempcustomer = new Customers { FirstName = fn, LastName = ln, Phone = phone }; context.Add(_tempcustomer); context.SaveChanges(); } }