public ActionResult DeleteConfirmed(int id) { ServiceItemsModel serviceItemsModel = sil.find(id); sil.remove(serviceItemsModel); return(RedirectToAction("Index")); }
public ActionResult Edit(WorkModel workModel, int[] service, int customer, int item) { if (service != null) { foreach (var id in service) { ServicesModel ser = wl.db.Services.Find(id); workModel.service.Add(ser); } } if (customer != 0) { CustomersModel cm = wl.db.Customers.Find(customer); workModel.customer = cm; } if (item != 0) { ServiceItemsModel sim = wl.db.ServiceItems.Find(item); workModel.item = sim; } wl.edit(workModel); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "serviceItemID,serviceItemName")] ServiceItemsModel serviceItemsModel) { if (ModelState.IsValid) { sil.edit(serviceItemsModel); return(RedirectToAction("Index")); } return(View(serviceItemsModel)); }
// GET: ServiceItems/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServiceItemsModel serviceItemsModel = sil.find(id); if (serviceItemsModel == null) { return(HttpNotFound()); } return(View(serviceItemsModel)); }
public ActionResult Create([Bind(Include = "serviceItemID,serviceItemName")] ServiceItemsModel serviceItemsModel) { if (ModelState.IsValid) { List <ServiceItemsModel> allItems = sil.ToList(); foreach (var item in allItems) { if (item.serviceItemName.Equals(serviceItemsModel.serviceItemName)) { return(View("Error", serviceItemsModel)); } } sil.create(serviceItemsModel); return(RedirectToAction("Index")); } return(View(serviceItemsModel)); }
public void remove(ServiceItemsModel serviceItemsModel) { db.ServiceItems.Remove(serviceItemsModel); db.SaveChanges(); }
public void edit(ServiceItemsModel serviceItemsModel) { db.Entry(serviceItemsModel).State = EntityState.Modified; db.SaveChanges(); }
public void create(ServiceItemsModel serviceItemsModel) { db.ServiceItems.Add(serviceItemsModel); db.SaveChanges(); }