public ActionResult Update(Master_ChicCut_ServiceModel model) { try { if (ModelState.IsValid) { using (TransactionScope ts = new TransactionScope()) { #region Dịch vụ model.ServiceName = _context.Master_ChicCut_ServiceCategoryModel.Find(model.ServiceCategoryId).ServiceName; _context.Entry(model).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); #endregion ts.Complete(); return(Content("success")); } } else { return(Content("Vui lòng kiểm tra lại thông tin không hợp lệ !")); } } catch { return(Content("Xảy ra lỗi trong quá trình thêm mới dịch vụ !")); } }
public ActionResult Save(Master_ChicCut_ServiceModel model, string returnURL = null) { try { if (ModelState.IsValid) { #region Dịch vụ model.ServiceName = _context.Master_ChicCut_ServiceCategoryModel.Find(model.ServiceCategoryId).ServiceName; _context.Master_ChicCut_ServiceModel.Add(model); _context.SaveChanges(); int ServiceId = model.ServiceId; #endregion if (returnURL.Equals("None")) { return(Content("success")); } else { return(Content(string.Format("/MasterChicCutService/Edit/{0}", ServiceId))); } } else { return(Content("ErrorInfo")); } } catch { return(Content("ErrorOccur")); } }
public ActionResult Create() { Master_ChicCut_ServiceModel model = new Master_ChicCut_ServiceModel() { Actived = true }; CreateViewBag(null, null); return(View(model)); }