Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AttMachineTableRefrence attMachineTableRefrence = db.AttMachineTableRefrences.Find(id);

            db.AttMachineTableRefrences.Remove(attMachineTableRefrence);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Id,MachineID,TableID")] AttMachineTableRefrence attMachineTableRefrence)
 {
     if (ModelState.IsValid)
     {
         db.Entry(attMachineTableRefrence).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MachineID = new SelectList(db.AttMachines, "MachId", "MachineName", attMachineTableRefrence.MachineID);
     ViewBag.TableID   = new SelectList(db.AttTableDefinations, "TableId", "ColumnDefination", attMachineTableRefrence.TableID);
     return(View(attMachineTableRefrence));
 }
Пример #3
0
        // GET: AttMachineTableRefrences/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AttMachineTableRefrence attMachineTableRefrence = db.AttMachineTableRefrences.Find(id);

            if (attMachineTableRefrence == null)
            {
                return(HttpNotFound());
            }
            return(View(attMachineTableRefrence));
        }
Пример #4
0
        // GET: AttMachineTableRefrences/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AttMachineTableRefrence attMachineTableRefrence = db.AttMachineTableRefrences.Find(id);

            if (attMachineTableRefrence == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MachineID = new SelectList(db.AttMachines, "MachId", "MachineName", attMachineTableRefrence.MachineID);
            ViewBag.TableID   = new SelectList(db.AttTableDefinations, "TableId", "ColumnDefination", attMachineTableRefrence.TableID);
            return(View(attMachineTableRefrence));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "Id,MachineID,TableID")] AttMachineTableRefrence attMachineTableRefrence)
        {
            if (ModelState.IsValid)
            {
                var machineid = attMachineTableRefrence.MachineID;
                var check     = db.AttMachineTableRefrences.Where(a => a.MachineID == machineid).Count();
                if (check > 0)
                {
                    TempData["failed"] = "This machine is already assign to table before";
                    return(RedirectToAction("Create"));
                }
                db.AttMachineTableRefrences.Add(attMachineTableRefrence);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MachineID = new SelectList(db.AttMachines, "MachId", "MachineName", attMachineTableRefrence.MachineID);
            ViewBag.TableID   = new SelectList(db.AttTableDefinations, "TableId", "ColumnDefination", attMachineTableRefrence.TableID);
            return(View(attMachineTableRefrence));
        }