示例#1
0
        /// <summary>
        /// Display page that allows user to propose alternative date
        /// </summary>
        /// <param name="id">Unique identifier of the appointment</param>
        /// <returns>View</returns>
        public async Task <IActionResult> EditAlternative(int id)
        {
            //- Get Appointment
            var resultModel = await _appointmentDataAccess.GetAppointmentByIDAsync(id);


            //- Check for Appointment
            if (resultModel.Appointment == null)
            {
                return(NotFound());
            }


            //- Navbar
            UpdateNavBar(resultModel.StatusInfo);

            SetPageTitle("Alternative");


            //- Create ViewModel
            EditAlternativeAppointmentViewModel vm = new EditAlternativeAppointmentViewModel()
            {
                Appointment = resultModel.Appointment
            };


            return(View(vm));
        }
示例#2
0
        public async Task <IActionResult> EditAlternative(int id, EditAlternativeAppointmentViewModel model)
        {
            //- Check Status
            if (ModelState.IsValid == false)
            {
                return(View(model));
            }


            //- Update Data Store
            bool isSuccess = await _appointmentDataAccess.SetAlternativeAppointmentAsync(id, model.Appointment.AlternativeDateTimeOffset);

            if (isSuccess == false)
            {
                return(NotFound());
            }


            return(RedirectToAction("AlternativeConfirmation"));
        }