private bool BoxCreate(Smt_box item) { return(CheckIsNotProcessingApply(db.SmtBoxes, x => { if (x.FirstOrDefault(y => y.Code == item.Code && y.ElementId == item.ElementId) == null) { x.Add(item); return true; } else { return false; } })); }
public bool Update(Smt_box item) { if (item == null) { throw new ArgumentNullException("Item cannot be null"); } if (IsNotProcessing()) { var tmp = db.SmtBoxes.FirstOrDefault(x => x.ElementId == item.ElementId && x.Code == item.Code); if (tmp != null) { tmp.CreationDate = item.CreationDate; tmp.ElementId = item.ElementId; tmp.Spent = item.Spent; tmp.InFeeder = item.InFeeder; return(true); } } return(false); }
public ActionResult CreateBox(int?id) { if (id == null) { return(RedirectToAction("Index")); } var tmp = u.Get(delegate(Element x) { return(x.Code == id); }); if (tmp != null) { var box = new Smt_box(tmp); box.ElementId = tmp.Code; tmp.Boxes.Add(box); if (u.Create(box)) { u.Save(); return(RedirectToAction("Index")); } } return(RedirectToAction("Index")); }
public bool Delete(Smt_box Item) { return(Delete(db.SmtBoxes, Item)); }
public bool Create(Smt_box item) { return(BoxCreate(item)); }