Пример #1
0
 public ActionResult Edit(Regres regres)
 {
     var db = new RegresDBContext();
     if (ModelState.IsValid)
     {
         db.Entry(regres).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("MyList");
     }
     
     return View(regres);
 }
Пример #2
0
 public ActionResult Edit(int? id)
 {
     if (id != null)
     {
         Regres regres;
         using (var db = new RegresDBContext())
         {
             regres = db.Regresy.ToList().Where(r => r.RegresId == id).First();
         }
         return View(regres);
     }
     else
     {
         return View("Index");
     }
 }
Пример #3
0
        public ActionResult MyList(string claimNum)
        {
            int numOfPages;
            List<Regres> regresy;
            var currentUser = UserManager.FindById(User.Identity.GetUserId());
            using (var db = new RegresDBContext())
            {
                db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
                regresy = db.Regresy.Where(x => x.Employee == currentUser.Initial).ToList();
            }
            if (!String.IsNullOrEmpty(claimNum))
                regresy = regresy.Where(x => x.ClaimNumber == claimNum).ToList();

            numOfPages = regresy.Count / 50;
            ViewBag.NumberOfPages = numOfPages;

            return View(regresy);
        }