public ActionResult DeleteConfirmed(int id, string photo)
        {
            string directoryToDelete = Server.MapPath(Url.Content("~/Content/Images"));

            ImageFiles.DeleteFile(directoryToDelete, photo);

            menuCategoryRepository.Delete(id);
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit([Bind(Include = "Id,NameCategory,Photo,Comment")] MenuCategory menuCategory, HttpPostedFileBase uploadedFile)
        {
            if (ModelState.IsValid)
            {
                string directory = Server.MapPath(Url.Content("~/Content/Images"));
                ImageFiles.DeleteFile(directory, menuCategory.Photo);
                menuCategory.Photo = ImageFiles.AddFile(directory, uploadedFile);

                menuCategoryRepository.Update(menuCategory);
                return(RedirectToAction("Index"));
            }
            return(View(menuCategory));
        }
        public ActionResult Edit([Bind(Include = "Id,NameDish,CompositionDish,Weight,Price,MenuCategoryId")] Dish dish, string photoName, HttpPostedFileBase uploadedFile)
        {
            if (ModelState.IsValid)
            {
                dish.Photo = photoName;

                string directory = Server.MapPath(Url.Content("~/Content/Images"));
                ImageFiles.DeleteFile(directory, photoName);
                dish.Photo = ImageFiles.AddFile(directory, uploadedFile);

                dishRepository.Update(dish);
                return(RedirectToAction("Index"));
            }
            var menuCategories = menuCategoryRepository.MenuCategories.ToList();

            ViewBag.MenuCategoryId = new SelectList(menuCategories, "Id", "NameCategory", dish.MenuCategoryId);
            return(View(dish));
        }