Ejemplo n.º 1
0
 public ActionResult AddTest(TestAddModel objTestAddModel)
 {
     if (ModelState.IsValid)
     {
         int hospitalId = int.Parse(objTestAddModel.HospitalName);
         var checkIsCurrentTestAlreadyExist =
             _db.Tests.Any(x => x.TestName.Equals(objTestAddModel.Test) && x.HospitalId.Equals(hospitalId));
         if (!checkIsCurrentTestAlreadyExist)
         {
             var objTest = new Test
             {
                 TestName   = objTestAddModel.Test,
                 Coast      = objTestAddModel.Coast,
                 HospitalId = hospitalId
             };
             _db.Tests.Add(objTest);
             _db.SaveChanges(); ModelState.Clear();
         }
         else
         {
             ModelState.AddModelError("", "Test " + "\'" + objTestAddModel.Test + "\'" + " " + "already exist.");
         }
     }
     DisplayHospitalSelectlist();
     return(View());
 }
Ejemplo n.º 2
0
        public ActionResult TestInsert(TestAddModel test)
        {
            Guid customerId = (System.Guid)Session["userID"];

            Business.Test.TestInsert(customerId, test.TestName, test.Url);
            //return View(test);
            return(RedirectToAction("TestList", "Home"));
        }