public ActionResult Edit(News news, HttpPostedFileBase image) { news.Modified = DateTime.Now; news.ModifieddBy = Notice.SystemAddmin; if (ModelState.IsValid) { string fullPath = "~/NewsImage/" + news.Id.ToString() + news.Image; if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } if (image != null && image.ContentLength > 0) { var fileName = Path.GetFileName(image.FileName); news.Image = fileName; if (fileName != null) { image.SaveAs(Server.MapPath(Url.Content("~/NewsImage/" + news.Id.ToString() + news.Image))); } } db.Entry(news).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(news)); }
public ActionResult Edit(FeedBacks feedBacks) { if (ModelState.IsValid) { db.Entry(feedBacks).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction(Notice.Index)); } return(View(feedBacks)); }
public ActionResult Edit([Bind(Include = "RoleId,RoleName")] UserRole userRole) { if (ModelState.IsValid) { db.Entry(userRole).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userRole)); }
public ActionResult Edit([Bind(Include = "Id,Name,Phone,Email")] Register register) { if (ModelState.IsValid) { db.Entry(register).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(register)); }
public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RoleId = new SelectList(db.UserRoles, "RoleId", "RoleName", user.RoleId); return(View(user)); }
public ActionResult Edit(Categories categories) { categories.ModifieddBy = Notice.SystemAddmin; categories.Modified = DateTime.Now; if (ModelState.IsValid) { db.Entry(categories).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categories)); }
public ActionResult EditRequest(Request request) { if (ModelState.IsValid && Request.Cookies["user"] != null) { Request r = learn.Requests.Find(request.Id); if (request.Title != null) { r.Title = request.Title; } if (request.Describtion != null) { r.Describtion = request.Describtion; } if (request.Cost != 0) { r.Cost = request.Cost; } learn.Entry(r).State = EntityState.Modified; learn.SaveChanges(); return(RedirectToAction("Requests")); } return(View("Requests")); }