public ActionResult Create(CMSCategoryView model) { if (ModelState.IsValid) { try { if (User.IsInRole("Administrator")) { model.Status = (int)Define.Status.Active; } else { model.Status = (int)Define.Status.WaitingCreate; } model.CreatedBy = User.Identity.GetUserName(); _cmsCategoryService.AddCMSCategory(model); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } } ViewBag.AvailableCategories = PrepareAllCategoriesModel(); return(View(model)); }
public ActionResult Create(CMSCategoryView model) { if (ModelState.IsValid) { try { _cmsCategoryService.AddCMSCategory(model); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } } ViewBag.AvailableCategories = PrepareAllCategoriesModel(); return(View(model)); }