public bool Update(int?Id, RestaurantParam restaurantParam) { var result = 0; Restaurant getRestaurant = Get(Id); getRestaurant.Name = restaurantParam.Name; getRestaurant.Description = restaurantParam.Description; getRestaurant.Cinemas = myContext.Cinemas.Find(restaurantParam.Cinemas_Id); getRestaurant.UpdateDate = DateTimeOffset.Now.LocalDateTime; result = myContext.SaveChanges(); if (result > 0) { status = true; } return(status); }
public bool Insert(RestaurantParam restaurantParam) { var result = 0; restaurant.Name = restaurantParam.Name; restaurant.Description = restaurantParam.Description; restaurant.Cinemas = myContext.Cinemas.Find(restaurantParam.Cinemas_Id); restaurant.CreateDate = DateTimeOffset.Now.LocalDateTime; restaurant.IsDelete = false; myContext.Restaurants.Add(restaurant); result = myContext.SaveChanges(); if (result > 0) { status = true; } return(status); }
// PUT: api/Restaurants/5 public void Put(int id, RestaurantParam restaurantParam) { _restaurantService.Update(id, restaurantParam); }
// POST: api/Restaurants public void Post(RestaurantParam restaurantParam) { _restaurantService.Insert(restaurantParam); }
public bool Update(int?Id, RestaurantParam restaurantParam) { _restaurantRepository.Update(Id, restaurantParam); return(status = true); }
public bool Insert(RestaurantParam restaurantParam) { _restaurantRepository.Insert(restaurantParam); return(status = true); }