示例#1
0
 /// <summary>
 /// Wes Richardson
 /// Created: 2019/04/11
 ///
 /// </summary>
 /// <returns>Appointment Index View</returns>
 public ActionResult Index()
 {
     try
     {
         _appointments = _appointmentMgr.RetrieveAppointmentsByGuestID(_guestID);
         if (_appointments == null || _appointments.Count < 1)
         {
             ViewBag.errorMessage = "No Appointments could be found";
             return(RedirectToAction("Error"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.errorMessage = ex.Message;
         RedirectToAction("Error");
     }
     return(View(_appointments));
 }
        // GET: MyAccount/ViewAppointments/5
        public ActionResult ViewAppointments(int id)
        {
            List <Appointment> appt;

            try
            {
                appt = apptManager.RetrieveAppointmentsByGuestID(id);
            }
            catch (Exception ex)
            {
                TempData["error"] = new ErrorViewModel(
                    Title: "Your Appointments",
                    Message: "We could not pull up a list of your appointments!",
                    ExceptionMessage: ex.Message,
                    ButtonMessage: "Back to Account",
                    ReturnController: "MyAccount",
                    ReturnAction: "Index"
                    );

                return(RedirectToAction("Index", "Error"));
            }
            return(View(appt));
        }