public ActionResult DeleteConfirmed(int id) { tcService tcService = db.tcServices.Find(id); db.tcServices.Remove(tcService); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Price")] tcService tcService) { if (ModelState.IsValid) { db.Entry(tcService).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tcService)); }
public ActionResult Create([Bind(Include = "Id,Name,Price")] tcService tcService) { if (ModelState.IsValid) { db.tcServices.Add(tcService); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tcService)); }
public tcService GetService(int id) { if (!serviceExists(id)) { return(null); } var tcService = db.tcServices.Find(id); var service = new tcService() { Id = tcService.Id, Name = tcService.Name, Price = tcService.Price }; return(service); }
// GET: tcServices/Edit/5 public ActionResult Edit(int?id) { if (IsAllowed() == false) { return(RedirectToAction("Index", "Login")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tcService tcService = db.tcServices.Find(id); if (tcService == null) { return(HttpNotFound()); } return(View(tcService)); }