public ActionResult Edit(Services_details services_details, HttpPostedFileBase doc) { if (ModelState.IsValid) { Services_details Services_details_update = db.Services_details.Find(services_details.Service_Detail_Id); Services_details_update.Service_Detail_Name = services_details.Service_Detail_Name; Services_details_update.Service_Detail_Description = services_details.Service_Detail_Description; Services_details_update.service_Status = services_details.service_Status; Services_details_update.Service_Id = services_details.Service_Id; if (doc != null) { var filename = Path.GetFileName(doc.FileName); var extension = Path.GetExtension(filename).ToLower(); if (extension == ".jpg" || extension == ".png") { var path = HostingEnvironment.MapPath(Path.Combine("~/Content/Images/", filename)); doc.SaveAs(path); Services_details_update.Service_Detail_Image = "~/Content/Images/" + filename; } } services_details.service_Date = DateTime.Now; db.Entry(Services_details_update).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(services_details)); }
// GET: Services/Details/5 public ActionResult Details(int id) { Services_details details = db.Services_details.Where(m => m.Service_Id == id).SingleOrDefault(); ViewBag.Current = id; return(View(details)); }
public ActionResult DeleteConfirmed(int id) { Services_details services_details = db.Services_details.Find(id); db.Services_details.Remove(services_details); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Services_details/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Services_details services_details = db.Services_details.Find(id); if (services_details == null) { return(HttpNotFound()); } return(View(services_details)); }
// GET: Services_details/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Services_details services_details = db.Services_details.Find(id); if (services_details == null) { return(HttpNotFound()); } ViewBag.Service_Id = new SelectList(db.Servicess, "Service_Id", "Service_Name", services_details.Service_Id); return(View(services_details)); }
public ActionResult Create(HttpPostedFileBase doc, Services_details services_details) { if (ModelState.IsValid) { var filename = Path.GetFileName(doc.FileName); var extension = Path.GetExtension(filename).ToLower(); if (extension == ".jpg" || extension == ".png") { var path = HostingEnvironment.MapPath(Path.Combine("~/Content/Images/", filename)); doc.SaveAs(path); services_details.Service_Detail_Image = "~/Content/Images/" + filename; } services_details.service_Status = true; services_details.service_Date = DateTime.Now; db.Services_details.Add(services_details); db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.Service_Id = new SelectList(db.Servicess, "Service_Id", "Service_Name", services_details.Service_Id); return(View(services_details)); }