public ActionResult DishesPublish(string DishesName, string UnitPrice, int CategoryId) { Dishes dishes = new Dishes(); dishes.UnitPrice = int.Parse(UnitPrice); dishes.DishesName = DishesName; dishes.CategoryId = CategoryId; DishesBLL.Create(dishes); Dishes dishess = new Dishes(); dishess = DishesBLL.Get(o => o.DishesName == DishesName); HttpPostedFileBase file = Request.Files["DishesImage"]; string filePath = Server.MapPath(string.Format("~/{0}", "Images/dishes")); string imagename = dishess.DishesId + ".PNG"; string savePath; savePath = Path.Combine(filePath, imagename); file.SaveAs(savePath); return(RedirectToAction("Index")); }