Esempio n. 1
0
        public ActionResult DeleteConfirmed(string id)
        {
            SHELF sHELF = db.SHELF.Find(id);

            db.SHELF.Remove(sHELF);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "SHELF_ID,SHELF_AREA")] SHELF sHELF)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sHELF).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sHELF));
 }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "SHELF_ID,SHELF_AREA")] SHELF sHELF)
        {
            if (ModelState.IsValid)
            {
                db.SHELF.Add(sHELF);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sHELF));
        }
        public void Delete(string id)
        {
            SHELF myShelf = db.SHELF.Find(id);

            if (myShelf == null)
            {
                return;
            }

            db.SHELF.Remove(myShelf);
            db.SaveChanges();
        }
Esempio n. 5
0
        // GET: SHELves/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SHELF sHELF = db.SHELF.Find(id);

            if (sHELF == null)
            {
                return(HttpNotFound());
            }
            return(View(sHELF));
        }
        public JsonResult createShelf(string para01, string para02)
        {
            string shelf_id   = para01;
            string shelf_area = para02;

            SHELF newShelf = new SHELF();

            newShelf.SHELF_ID   = shelf_id;
            newShelf.SHELF_AREA = shelf_area;
            db.SHELF.Add(newShelf);
            db.SaveChanges();

            var list2 = db.SHELF.Where(n => n.SHELF_ID != "0").Select(n => new { SHELF_ID = n.SHELF_ID, SHELF_AREA = n.SHELF_AREA });

            return(Json(new { code = 0, msg = "", count = 1000, data = list2 }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public string editTest(string para01, string para02)
        {
            string bat_id   = para01;
            string shelf_id = para02;


            SHELF myShelf = db.SHELF.Find(shelf_id);

            if (myShelf == null)
            {
                return("1");
            }
            else
            {
                return("2");
            }
        }
 public ActionResult saveShelves(List <string> toBeDeleted, List <string> toBeAdded)
 {
     try
     {
         CMSEntities m_context = new CMSEntities();
         m_context.Configuration.ProxyCreationEnabled = false;
         List <string> failedToDelete = new List <string>();
         if (toBeAdded != null)
         {
             foreach (var item in toBeAdded)
             {
                 var query = m_context.SHELves.Where(a => a.NAME_AR == item);
                 if (!query.Select(q => q.NAME_AR).Contains(item))
                 {
                     m_context.SHELves.Add(new SHELF {
                         NAME_AR = item
                     });
                 }
             }
             m_context.SaveChanges();
         }
         if (toBeDeleted != null)
         {
             foreach (var item in toBeDeleted)
             {
                 try
                 {
                     SHELF s = (SHELF)m_context.SHELves.Where(a => a.NAME_AR == item).First();
                     m_context.SHELves.Remove(s);
                     m_context.SaveChanges();
                 }
                 catch (Exception ex)
                 {
                     failedToDelete.Add(item);
                 }
             }
         }
         var current = (from row in m_context.SHELves select row.NAME_AR).ToList();
         return(Json(new object[] { failedToDelete, current }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         throw;
     }
 }
        public JsonResult editShelf(string para01, string para02)
        {
            string shelf_id   = para01;
            string shelf_area = para02;

            SHELF myShelf = db.SHELF.Find(shelf_id);

            myShelf.SHELF_AREA = shelf_area;

            db.Entry(myShelf).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }

            var list2 = db.SHELF.Where(n => n.SHELF_ID != "0").Select(n => new { SHELF_ID = n.SHELF_ID, SHELF_AREA = n.SHELF_AREA });

            return(Json(new { code = 0, msg = "", count = 1000, data = list2 }, JsonRequestBehavior.AllowGet));
        }