コード例 #1
0
 public Model.Restaurant AddRestaurant(Model.Restaurant restaurant)
 {
     //This records a change in the context change tracker that we want to add this particular entity to the
     // db
     _context.Restaurants.Add(
         restaurant
         );
     //This persists the change to the db
     // Note: you can create a separate method that persists the changes so that you can execute repo commands in
     //the BL and save changes only when all the operations return no exceptions
     _context.SaveChanges();
     return(restaurant);
 }
コード例 #2
0
 public bool Equals(Restaurant restaurant)
 {
     return(this.Name.Equals(restaurant.Name) && this.City.Equals(restaurant.City) && this.State.Equals(restaurant.State));
 }