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 Guid AddContentMenu(AddContentMenuCommand command) { var contentMenu = new ContentMenu() { ContentMenuId = Guid.NewGuid(), Description = command.Description, Image = command.Image, Title = command.Title, MetaDescription = command.MetaDescription, MetaKeywork = command.MetaKeywork }; _contentMenuService.Insert(contentMenu); _unitOfWork.SaveChanges(); return contentMenu.ContentMenuId; }