public ActionResult Create() { Master_ChicCut_ServiceCategoryModel model = new Master_ChicCut_ServiceCategoryModel(); model.Actived = true; CreateViewBag(null); return(View(model)); }
public ActionResult Edit(int id) { Master_ChicCut_ServiceCategoryModel model = _context.Master_ChicCut_ServiceCategoryModel.Find(id); if (model == null) { return(HttpNotFound()); } CreateViewBag(model.ServiceParentCategoryId); return(View(model)); }
public ActionResult Edit(Master_ChicCut_ServiceCategoryModel model) { if (ModelState.IsValid) { if (model.OrderBy <= 0) { ModelState.AddModelError("LonHon0", new Exception("Vui lòng nhập thứ tự lớn hơn 0")); return(View(model)); } _context.Entry(model).State = EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }