コード例 #1
0
 public ActionResult Details(string firstName, string lastName)
 {
     TempData["pfirstname"] = firstName;
     TempData["plastname"]  = lastName;
     if (ModelState.IsValid)
     {
         List <Prescription> prescriptions = new List <Prescription>();
         prescriptions = PrescriptionDAL.GetPrescriptions(firstName, lastName);
         return(View(prescriptions));
     }
     else
     {
         ModelState.AddModelError("", "Enter valid Patient Name..!!");
         return(View());
     }
 }
コード例 #2
0
        public ActionResult CreatePrescription_Post()
        {    // Retrieve form data using form collection
            Prescription prescription = new Prescription();

            prescription.Appointmentid = int.Parse(TempData["appointmentid"].ToString());
            prescription.Dusername     = TempData["username"].ToString();
            TempData.Keep();
            prescription.Pfirstname = TempData["firstname"].ToString();
            prescription.Plastname  = TempData["lastname"].ToString();
            prescription.Timeslot   = TempData["timeslot"].ToString();
            prescription.Date       = TempData["date"].ToString();

            TryUpdateModel(prescription);
            if (ModelState.IsValid)
            {
                PrescriptionDAL.CreatePrescription(prescription);
                return(RedirectToAction("Index", "Doctor"));
            }
            else
            {
                return(View());
            }
        }