public IActionResult Edit(String id) { if (String.IsNullOrEmpty(id)) { return(RedirectToAction("Create")); } var model = new CategoriesCreateEditModel(id); return(View("CreateEdit", model)); }
private IActionResult createEditForHtmlForm(CategoriesCreateEditModel model) { if (ModelState.IsValid) { var error = model.CreateEdit(); if (error != null) { ModelState.AddModelError("Category.Name", HttpContext.Translate(error)); } } if (ModelState.IsValid) { return(RedirectToAction("Index")); } return(View("CreateEdit", model)); }
public IActionResult Edit(String id, CategoriesCreateEditModel model) { model.Type = OperationType.Edition; return(createEditForHtmlForm(model)); }
public IActionResult Create(CategoriesCreateEditModel model) { model.Type = OperationType.Creation; return(createEditForHtmlForm(model)); }
public IActionResult Create() { var model = new CategoriesCreateEditModel(); return(View("CreateEdit", model)); }