public void AddNEItem(NonExpirationItem n)
 {
     using (DataLayerDataContext db = new DataLayerDataContext())
     {
         db.NonExpirationItems.InsertOnSubmit(n);
         db.SubmitChanges();
         AddAction(n.UserId, "Add Non Expiration Item " + n.Name, DateTime.Now);
     }
 }
 public void UpdateNEItem(NonExpirationItem n)
 {
     using (DataLayerDataContext db = new DataLayerDataContext())
     {
         NonExpirationItem item = db.NonExpirationItems.FirstOrDefault(i => i.Id == n.Id);
         item.Name  = n.Name;
         item.Notes = n.Notes;
         item.Date  = n.Date;
         db.SubmitChanges();
         AddAction(item.UserId, "Update Non Expiration Item " + item.Name, DateTime.Now);
     }
 }
Ejemplo n.º 3
0
        public ActionResult AddNonExpirationItem(string NEName, DateTime NEDate, string NENotes)
        {
            var mgr             = new UserPortalRepository();
            NonExpirationItem n = new NonExpirationItem();

            n.UserId = int.Parse(User.Identity.Name);
            n.Name   = NEName;
            if (NENotes != null)
            {
                n.Notes = NENotes;
            }
            n.Date = NEDate;
            mgr.AddNEItem(n);
            TempData["success"] = "A non expiration item was successfully added";
            return(RedirectToAction("index"));
        }
Ejemplo n.º 4
0
        public ActionResult UpdateNEItem(string ENEName, DateTime ENEDate, string ENENotes, int ENEitemid)
        {
            var mgr             = new UserPortalRepository();
            NonExpirationItem n = new NonExpirationItem();

            n.UserId = int.Parse(User.Identity.Name);
            n.Name   = ENEName;
            n.Id     = ENEitemid;
            if (ENENotes != null)
            {
                n.Notes = ENENotes;
            }
            n.Date = ENEDate;
            mgr.UpdateNEItem(n);
            TempData["success"] = "The item was updated successfully";
            return(RedirectToAction("index"));
        }