Example #1
0
        public Restaurant Add(Restaurant newRestaurant)
        {
            _context.Restaurants.Add(newRestaurant);
            // Save changes can be moved to a seperate method in order to do batch jobs
            _context.SaveChanges();

            // the new restaurant will always generate a new id
            return(newRestaurant);
        }
Example #2
0
 public Restaurant Add(Restaurant newRestaurante)
 {
     _context.Restaurants.Add(newRestaurante);
     _context.SaveChanges();
     return(newRestaurante);
 }
Example #3
0
 public Restaurant Add(Restaurant newRestaurant)
 {
     _context.Add(newRestaurant); // SQL Server will generate the Id value for the restaurant.
     _context.SaveChanges();      // Saves changes to the database.
     return(newRestaurant);
 }
Example #4
0
 Restaurant IRestaurantData.Add(Restaurant newRestaurant)
 {
     _context.Restaurants.Add(newRestaurant);
     _context.SaveChanges();
     return(newRestaurant);
 }
 public int commit()
 {
     return(db.SaveChanges());
 }
Example #6
0
 public Resturant Add(Resturant resturant)
 {
     _context.Resturants.Add(resturant);
     _context.SaveChanges();
     return(resturant);
 }
Example #7
0
 public int Commit()
 {
     return(_context.SaveChanges());
 }