예제 #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 void TestMethod1()
        {
            // test obejmujący model regres
            Regres r1 = new Regres
            {
                RegresId = 1,
                ClaimNumber = "W201502021945-01",
                ReceivedDate = DateTime.Today,
                Deadline = DateTime.Today.AddMonths(3),
                Employee = "MR",
                WaitingForCourt = false
            };

            Regres r2 = new Regres
            {
                RegresId = 1,
                ClaimNumber = "W201505051542-01",
                ReceivedDate = DateTime.Today,
                Deadline = DateTime.Today.AddMonths(3),
                Employee = "DR",
                WaitingForCourt = false
            };

            Regres r3 = new Regres
            {
                RegresId = 1,
                ClaimNumber = "W201502215632-01",
                ReceivedDate = DateTime.Today,
                Deadline = DateTime.Today.AddMonths(3),
                Employee = "WR",
                WaitingForCourt = false
            };
            // test poprawności numeru
            Assert.AreEqual(r1.ClaimNumber, "W201502021945-01");
            Assert.AreEqual(r2.ClaimNumber, "W201505051542-01");
            Assert.AreEqual(r3.ClaimNumber, "W201502215632-01");
            // test poprawności daty
            Assert.AreEqual(r1.ReceivedDate, DateTime.Today);
            Assert.AreEqual(r2.ReceivedDate, DateTime.Today);
            Assert.AreEqual(r3.ReceivedDate, DateTime.Today);
        }