// GET: Admin/CustomerSliders/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerSlider customerSlider = db.CustomerSliders.Find(id); if (customerSlider == null) { return(HttpNotFound()); } return(View(customerSlider)); }
// GET: Admin/CustomerSliders/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerSlider customerSlider = db.CustomerSliders.Find(id); if (customerSlider == null) { return(HttpNotFound()); } db.CustomerSliders.Remove(customerSlider); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(CustomerSlider customerSlider) { try { customerSlider.Photo = FileManager.Upload(customerSlider.PhotoUpload); } catch (Exception e) { ModelState.AddModelError("PhotoUpload", e.Message); } if (ModelState.IsValid) { db.CustomerSliders.Add(customerSlider); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerSlider)); }
public ActionResult Edit([Bind(Include = "Id,Photo,FullName,WhatProblems,Text,Status,PhotoUpload")] CustomerSlider customerSlider) { try { customerSlider.Photo = FileManager.Upload(customerSlider.PhotoUpload); } catch (Exception e) { ModelState.AddModelError("PhotoUpload", e.Message); } if (ModelState.IsValid) { db.Entry(customerSlider).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerSlider)); }