Esempio n. 1
0
 public IActionResult EditCake(Cake cake)
 {
     if (ModelState.IsValid)
     {
         if (cakeRepository.Edit(cake) != null)
         {
             return(RedirectToAction("ViewCake", "Home", new { id = cake.CakeId }));
         }
     }
     ModelState.AddModelError("", "Có lỗi trong quá trình thực hiện, xin hãy thử lại!");
     return(View());
 }
Esempio n. 2
0
        public IActionResult Edit(HomeEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var editStd = new Cake()
                {
                    Id        = model.Id,
                    nameCake  = model.nameCake,
                    ThanhPhan = model.ThanhPhan,

                    Hsd        = model.Hsd,
                    Nsx        = model.Nsx,
                    GiaBan     = model.GiaBan,
                    DaXoa      = model.DaXoa,
                    CategoryId = model.CategoryId
                };
                studentRepository.Edit(editStd);


                return(RedirectToAction("ViewDetail", "Home", new { id = editStd.CategoryId }));
            }
            ViewBag.Category = GetClasses();
            return(View());
        }