public Restaurant Add(Restaurant restaurant)
        {
            _context.Add(restaurant);
            _context.SaveChanges();

            return(restaurant);
        }
Пример #2
0
        public Restaurant Create(Restaurant newRestaurant)
        {
            // TODO: Use async version.
            context.Add(newRestaurant);

            return(newRestaurant);
        }
Пример #3
0
 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);
 }
Пример #4
0
        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);
        }
Пример #5
0
        /// <summary>
        /// Adds a new Restaurant object to the database
        /// </summary>
        /// <param name="newRestaurant"></param>
        /// <returns></returns>
        public Restaurant Add(Restaurant newRestaurant)
        {
            // Add the newRestaurant to the database.
            // The context is smart enough to know that this is a restaurant object and it goes in the Restaurants table (DbSet<Restaurant>)
            _context.Add(newRestaurant);

            // Return the newly created restaurant.
            return(newRestaurant);
        }
Пример #6
0
        public async Task <IActionResult> Create([Bind("Name,Location,Id,Cusine")] Restaurant restaurant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(restaurant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(restaurant));
        }
Пример #7
0
 public void Add(Restaurant restaurant)
 {
     _context.Add(restaurant);
     _context.SaveChanges();
 }
Пример #8
0
 public void Add(Restaurant newRestaurant)
 {
     _context.Add(newRestaurant);
 }
Пример #9
0
 public RestaurantModel Add(RestaurantModel newRestaurant)
 {
     _dbContext.Add(newRestaurant);
     return(newRestaurant);
 }
Пример #10
0
 public Resturant Add(Resturant newResturant)
 {
     _context.Add(newResturant);
     _context.SaveChanges();
     return(newResturant);
 }
Пример #11
0
 public Restaurant Add(Restaurant newRestaurant)
 {
     _odeToFoodDbContext.Add(newRestaurant);
     _odeToFoodDbContext.SaveChanges();
     return(newRestaurant);
 }
Пример #12
0
 public void Add(Restaurant newRestaraunt)
 {
     _context.Add(newRestaraunt);
     _context.SaveChanges();
 }
Пример #13
0
        public Restaurant Add(Restaurant input)
        {
            context.Add(input);

            return(input);
        }
Пример #14
0
 public Restaurant Create(Restaurant restaurant)
 {
     _odeToFoodDbContext.Add(restaurant);
     return(restaurant);
 }
Пример #15
0
 public void Add(Restaurant restaurant)
 {
     _context.Add(restaurant);
 }
Пример #16
0
 public Restaurant Add(Restaurant newRestaurant)
 {
     _context.Add(newRestaurant);
     return(newRestaurant);
 }
Пример #17
0
 public FoodContact Add(FoodContact foodContact)
 {
     _context.Add(foodContact);
     _context.SaveChanges();
     return(foodContact);
 }