public ActionResult Edit(Guid? id) { var ContentMenu = new ContentMenuModel(); if (id != null) ContentMenu = Mapper.Map<ContentMenuDTO, ContentMenuModel>(_contentMenuReportService.GetById((Guid)id)); return View("Edit", ContentMenu); }
private void Save(ContentMenuModel model) { if (model.ContentMenuId == Guid.Empty) { var createCommand = new AddContentMenuCommand(model.Title,model.Image,model.MetaKeywork,model.MetaDescription,model.Description); model.ContentMenuId = _contentMenuCommandService.AddContentMenu(createCommand); } else { var updateCommand = new EditContentMenuCommand(model.ContentMenuId, model.Title, model.Image, model.MetaKeywork, model.MetaDescription, model.Description); _contentMenuCommandService.EditContentMenu(updateCommand); } }
public ActionResult Edit(ContentMenuModel model) { if (!ModelState.IsValid) { return ModelState.JsonValidation(); } try { Save(model); return ModelState.JsonValidation(new { Success = true, model.ContentMenuId }); } catch (Exception ex) { ModelState.AddModelError("Edit_contentMenu", ex.Message); } return ModelState.JsonValidation(); }