Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
        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());
        }