예제 #1
0
        public IActionResult Update(Cake cake, int id)
        {
            if (id != cake.Id)
            {
                return(BadRequest());
            }

            _cakeRepo.Update(cake);
            _unitOfWork.SaveAll();

            return(NoContent());
        }
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         var CakeFromDb = cakeRepository.GetCake(Product.Id);
         CakeFromDb.Name        = Product.Name;
         CakeFromDb.Description = Product.Description;
         CakeFromDb.Price       = Product.Price;
         CakeFromDb.ImageName   = Product.ImageName;
         CakeFromDb.Quantity    = Product.Quantity;
         CakeFromDb.Category    = Product.Category;
         cakeRepository.Update(CakeFromDb);
         return(RedirectToPage("/Admin/CakePage/CakeList"));
     }
     return(RedirectToPage());
 }
예제 #3
0
 public Cake Update(Cake cake)
 {
     return(_cakeRepository.Update(cake));
 }