示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ServiceItemsModel serviceItemsModel = sil.find(id);

            sil.remove(serviceItemsModel);
            return(RedirectToAction("Index"));
        }
示例#2
0
        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"));
        }
示例#3
0
 public ActionResult Edit([Bind(Include = "serviceItemID,serviceItemName")] ServiceItemsModel serviceItemsModel)
 {
     if (ModelState.IsValid)
     {
         sil.edit(serviceItemsModel);
         return(RedirectToAction("Index"));
     }
     return(View(serviceItemsModel));
 }
示例#4
0
        // 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));
        }
示例#5
0
        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));
        }
示例#6
0
 public void remove(ServiceItemsModel serviceItemsModel)
 {
     db.ServiceItems.Remove(serviceItemsModel);
     db.SaveChanges();
 }
示例#7
0
 public void edit(ServiceItemsModel serviceItemsModel)
 {
     db.Entry(serviceItemsModel).State = EntityState.Modified;
     db.SaveChanges();
 }
示例#8
0
 public void create(ServiceItemsModel serviceItemsModel)
 {
     db.ServiceItems.Add(serviceItemsModel);
     db.SaveChanges();
 }