public async Task <MenuCategory> Add(MenuCategory model) { var entity = _menuCategoryRepository.Add(model); await _menuCategoryRepository.SaveChangeAsync(); return(model); }
public ActionResult Create([Bind(Include = "Id,NameCategory,Comment")] MenuCategory menuCategory, HttpPostedFileBase uploadedFile) { if (ModelState.IsValid) { string directory = Server.MapPath(Url.Content("~/Content/Images")); menuCategory.Photo = ImageFiles.AddFile(directory, uploadedFile); menuCategoryRepository.Add(menuCategory); return(RedirectToAction("Index")); } return(View(menuCategory)); }