public ActionResult CreateCategory(CreateCategoryViewModel category) { if (!ModelState.IsValid) { return(View()); } if (MenuService.CreteCategory(category.ToEntity())) { return(RedirectToAction("Index", "menu")); } return(View()); }
public IActionResult Create(CreateCategoryViewModel model) { if (ModelState.IsValid) { //TODO: set message var category = model.ToEntity(); var categories = new List <Category> { category }; _unitOfWork.BookMetas.AddCategories(categories); _unitOfWork.SaveChanges(); return(RedirectToAction("Index")); } //TODO: set message return(View(model)); }