// The Id will be set to the Identity column // Framework will add the id value into the restaurant public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); // changes don't occur until you save _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant newRestaurant) { _context.Add(newRestaurant); _context.SaveChanges(); return(newRestaurant); }
/* Restaurant */ public Restaurant Add(Restaurant newRestaurant) { _context.Restaurants.Add(newRestaurant); // A brand new entity that we need to insert. _context.SaveChanges(); // Changes dont occur until this command is called. May want to have this in a diff method called SaveChanges, or Commit, or something because we may want to batch together multiple changes on a single transaction. return(newRestaurant); }
public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); //simple approach, the savechanges can be moved out _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); //TODO: unit of work _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant newRestaurant) { _context.Restaurants.Add(newRestaurant); _context.SaveChanges(); //data doesn't actually get modified in the DB until you run SaveChanges(); //generally you won't do this immediately. usually you'd want to put it in another method on the interface that will allow you to batch all your changes in a transaction //when save is complete, any new records will automatically have IDs added by entity framework by assuming that any IDs are identities which means the ID is auto-generated by SQL Server return(newRestaurant); }
public Restaurant Add(Restaurant restaurant) { _context.Add(restaurant); // You can save changes later in big projects as a method called Commit or whatever _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant restaurant) { //put on hold to add _context.Restaurants.Add(restaurant); //actually add it _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); //just for ease, but it needs to go in a special method for actual application perspectives _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); //dont need to call SaveChanges if we need to batch _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant newRestaurant) { _context.Restaurants.Add(newRestaurant); _context.SaveChanges(); // return same value that was passed in, but with id value populated return(newRestaurant); }
public Restaurant Add(Restaurant newRestaurant) { _context.Add(newRestaurant); ///may not want SaveChnages() to be here, want to make sure all changes are ready to be saved ///may _context.SaveChanges(); return(newRestaurant); }
public void Add(Restaurant restaurant) { _context.Add(restaurant); _context.SaveChanges(); }
public Restaurant Add(Restaurant restorantToAdd) { _restaurantsData.Restaurants.Add(restorantToAdd); _restaurantsData.SaveChanges(); return(restorantToAdd); }
public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); _context.SaveChanges(); // Better method use this in another method, you might save changes after multiple changes return(restaurant); // new id property will be generated by sql }
public int Commit() { return(_odeToFoodDbContext.SaveChanges()); }
public int Commit() { // TODO: Use async version. return(context.SaveChanges()); }
public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); // creates the id column in database server _context.SaveChanges(); return(restaurant); // the created id column is passed on to the object }
public void AddToInventory(Product prod) { _context.Products.Add(prod); _context.SaveChanges(); }
public FoodContact Add(FoodContact foodContact) { _context.Add(foodContact); _context.SaveChanges(); return(foodContact); }
public Restaurant Add(Restaurant newRestaurant) { _odeToFoodDbContext.Restaurants.Add(newRestaurant); _odeToFoodDbContext.SaveChanges(); return(newRestaurant); }
public Restaurante Add(Restaurante restaurante) { _context.Restaurantes.Add(restaurante); _context.SaveChanges(); return(restaurante); }
public int Commit() { return(_context.SaveChanges()); }
public void SaveChanges() { context.SaveChanges(); }
public void Commit() { _context.SaveChanges(); }
public void Add(Restaurant restaurant) { db.Restaurants.Add(restaurant); // add to Restaurants table in 'db' database db.SaveChanges(); // save changes made in Restaurants table }