Пример #1
0
 public void Add(Restaurant restaurant)
 {
     //this statement will check the constraints in the db class
     db.Restaurants.Add(restaurant);
     //commit changes, by creating an insert statement
     db.SaveChanges();
 }
Пример #2
0
 public void Add(Restaurant restaurant)
 {
     //we add the data to be saved as a parameter
     db.Restaurants.Add(restaurant);
     //Here we commit the changes
     db.SaveChanges();
 }
Пример #3
0
        public void Add(Restaurant restaurant)
        {
            db.Restaurants.Add(restaurant);

            // commit changes
            db.SaveChanges();
        }
Пример #4
0
 public void Add(Restaurant restaurant)
 {
     // it is not added yet, this is just unit of work
     // kinda like a transaction
     db.Restaurants.Add(restaurant);
     // next step saves it
     db.SaveChanges();
 }
Пример #5
0
        public int Add(RestaurantViewModel restaurantViewModel)
        {
            Restaurant restaurant = new Restaurant();

            //restaurant.Name = restaurantViewModel.Name;
            //restaurant.WeighterId = restaurantViewModel.selectedWeighterId;
            //restaurant.Cuisine = restaurantViewModel.Cuisine;

            restaurant    = AutoMapper.Mapper.Map <RestaurantViewModel, Restaurant>(restaurantViewModel);
            restaurant.Id = db.Restaurants.Max(r => r.Id) + 1;
            db.Restaurants.Add(restaurant);
            db.SaveChanges();

            return(restaurant.Id);
        }
Пример #6
0
 public void Add(Restaurant restaurant)
 {
     db.Restaurants.Add(restaurant);
     db.SaveChanges();
 }
Пример #7
0
 public Restaurant Add(Restaurant restaurant)
 {
     _context.Restaurants.Add(restaurant);
     _context.SaveChanges();
     return(restaurant);
 }
Пример #8
0
 public void Create(Restaurant restaurant)
 {
     dbContext.Restaurants.Add(restaurant);
     dbContext.SaveChanges();
 }
Пример #9
0
 public void Add(Restaurant restaurant)
 {
     dbContext.Restaurants.Add(restaurant);
     dbContext.SaveChanges(); // This is the point where it gets added.
 }
Пример #10
0
 public void AddRestaurant(Restaurant restaurant)
 {
     database.Restaurants.Add(restaurant);
     database.SaveChanges();
 }
Пример #11
0
 public void Create(RestaurantModel restaurant)
 {
     db.Restaurants.Add(restaurant);
     db.SaveChanges();
 }
Пример #12
0
 public void Add(Restaurant restaurant)
 {
     // id will be the primary key and it will be the identity column
     db.Restaurants.Add(restaurant);
     db.SaveChanges(); // commit to database
 }
 void IRestaurantData.Add(Restaurant restaurant)
 {
     db.Restaurants.Add(restaurant);
     db.SaveChanges();
 }
Пример #14
0
 public void Add(Restaurant restaurant)
 {
     db.Restaurants.Add(restaurant);
     db.SaveChanges(); // insert into db
 }
Пример #15
0
 public void Add(Restaurant restaurant)
 {
     db.Restaurants.Add(restaurant);
     db.SaveChanges(); //this will commint the changes into the DB by executing an Inster intreuction
 }
Пример #16
0
 public void Add(Restaurant restaurant)
 {
     context.Restaurants.Add(restaurant);
     context.SaveChanges();
 }