public ActionResult Create(MenuImgAreaSecond MenuImgAreaSecondSingle) { if (MenuImgAreaSecondSingle.ImgFile.ContentLength > 0) { var fileNm = Path.GetFileName(MenuImgAreaSecondSingle.ImgFile.FileName); var saveArea = Path.Combine(Server.MapPath("~/Public/images"), fileNm); MenuImgAreaSecondSingle.ImgFile.SaveAs(saveArea); MenuImgAreaSecondSingle.Image = fileNm; db.menuImgAreaSeconds.Add(MenuImgAreaSecondSingle); db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Edit(MenuImgAreaSecond MenuImgAreaSecondSingle) { db.Entry(MenuImgAreaSecondSingle).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }