public ActionResult EditAppointment(BookAppointmentViewModel viewModel) { string loggedInUser = (string)Session["loggedInUser"]; var result = _appointmentManager.EditAppointment(viewModel, loggedInUser); return(RedirectToAction("ListAppointments")); }
public ActionResult AvailableAppointments(BookAppointmentViewModel app) { //TODO... check why the date is not if (ModelState.IsValid) { var sTime = app.StartTime; var eTime = app.EndTime; string id = User.Identity.GetUserId(); var appointment = new Appointment() { Date = app.Date, StartTime = sTime, EndTime = eTime, PatientId = app.PatientId, UserId = id }; var created = _appointmentRepository.AddAppointment(appointment); if (created) { return(RedirectToAction("Index", new { date = app.Date })); } return(HttpNotFound()); } return(RedirectToAction("AvailableAppointments", new { id = app.PatientId, date = app.Date })); }
public ActionResult BookAppointment(BookAppointmentViewModel viewModel) { string loggedInUser = (string)Session["loggedInUser"]; var result = _appointmentManager.BookAppointment(viewModel, loggedInUser); return(Content(result)); }
public string EditAppointment(BookAppointmentViewModel viewModel, string loggedInUser) { var appointment = mapper.Map <BookAppointmentViewModel, Appointment>(viewModel); var result = _appointmentRepository.EditAppointment(appointment, loggedInUser); return(result); }
public ViewResult ManageService(long serviceId) { try { var context = _serviceProvider.GetRequiredService <AppointmentJournalContext>(); var service = context.Services.SingleOrDefault(s => s.Id == serviceId); var serviceProducerWorkDays = context.WorkDays .Where(wd => wd.ProducerId == service.ProducerId && wd.WorkDaysTimeSpans .Select(x => x.Service).Contains(service)).ToList(); var dates = DateTimePicker.CreateFourWeeksCalendar(serviceProducerWorkDays); var bookViewModel = new BookAppointmentViewModel() { Dates = dates, ServiceId = serviceId, ServiceName = service.Name }; return(View(bookViewModel)); } catch { // TODO конкретизировать ошибку return(View("Error", "Ошибка")); } }
public ActionResult BookUpdate(BookAppointmentViewModel viewModel) { if (viewModel.Updating) { var updateBookingRequest = new UpdateAppointmentRequest { Id = viewModel.AppointmentId.Value, Date = viewModel.Date, StartTime = viewModel.StartTime, EndTime = viewModel.EndTime, LeadName = viewModel.LeadName, Address = viewModel.Address }; var validationResult = _appointmentService.ValidateUpdate(updateBookingRequest); if (!validationResult.IsValid) { foreach (var error in validationResult.Errors) { ModelState.AddModelError(error.Field ?? "", error.Text); } return(View("BookUpdate", viewModel)); } _appointmentService.Update(updateBookingRequest); } else { Guid id = Guid.NewGuid(); var makeBookingRequest = new BookAppointmentRequest { Id = id, ConsultantId = viewModel.ConsultantId.Value, Date = viewModel.Date, StartTime = viewModel.StartTime, EndTime = viewModel.EndTime, LeadName = viewModel.LeadName, Address = viewModel.Address }; var validationResult = _appointmentService.ValidateBook(makeBookingRequest); if (!validationResult.IsValid) { foreach (var error in validationResult.Errors) { ModelState.AddModelError(error.Field ?? "", error.Text); } return(View("BookUpdate", viewModel)); } _appointmentService.Book(makeBookingRequest); } return(RedirectToAction("Index", "Consultant", new { consultantId = viewModel.ConsultantId })); }
public ActionResult BookUpdate(bool updating, Guid?consultantId, Guid?appointmentId) { //todo: note: there is a bit of logic in here to convert between a booking and an appointment. var viewModel = new BookAppointmentViewModel { Updating = updating, ConsultantId = consultantId, AppointmentId = appointmentId }; if (updating) { var appointment = _appointmentService.GetById(appointmentId.Value); viewModel.LeadName = appointment.LeadName; viewModel.Address = appointment.Address; viewModel.Date = appointment.Start.Date; viewModel.StartTime = appointment.Start.TimeOfDay; viewModel.EndTime = appointment.End.TimeOfDay; } else { viewModel.Date = new DateTime(2012, 08, 01); viewModel.StartTime = new TimeSpan(09, 00, 00); viewModel.EndTime = new TimeSpan(09, 30, 00); } return(View(viewModel)); }
public ViewResult BookAppointment( int providerId ) { var model = new BookAppointmentViewModel { ProviderId = providerId }; return(View("/Views/BookAppointment.cshtml", model)); }
public void Save() { BookAppointmentViewModel ap = View.GetAppointment(); try { using (var proxy = _appointmentService.CreateChannel()) { proxy.AddAppointment(ap); } } catch (Exception ex) { throw; } }
public ActionResult Book() { var bookApptVM = new BookAppointmentViewModel() { Appointment = new Appointment(), Customer = new Customer(), Vehicle = new Vehicle(), ServiceTypes = new List <string> { "INTERIOR", "INTERIOR_EXTERIOR" }, VehicleTypes = new List <string> { "SUV", "SEDAN", "VAN", "TRUCK" } }; return(View(bookApptVM)); }
public async Task <IActionResult> BookAppointment(BookAppointmentViewModel model) { if (ModelState.IsValid) { var student = await userManager.GetUserAsync(User); var accreditation = accreditationRepository.Accreditations.First(a => a.AccreditationId == model.AccreditationId); var appointment = appointmentRepository.Appointments.First(a => a.AppointmentId == model.AppointmentId); var card = appointmentRepository.Cards.FirstOrDefault(c => c.CustomerId == student.Id); return(View("Payment", new PaymentViewModel { Accreditation = accreditation, Appointment = appointment, Card = card })); } return(View(model)); }
/// <summary> /// Метод для выбора дня для записи /// </summary> /// <param name="serviceId">ID услуги</param> /// <returns></returns> public ViewResult ChooseDay(long serviceId) { var context = _serviceProvider.GetRequiredService <AppointmentJournalContext>(); var service = context.Services.SingleOrDefault(s => s.Id == serviceId); var serviceProducerWorkDays = context.WorkDays .Where(wd => wd.ProducerId == service.ProducerId && wd.WorkDaysTimeSpans .Select(x => x.Service).Contains(service)).ToList(); var dates = DateTimePicker.CreateFourWeeksCalendar(serviceProducerWorkDays); var bookViewModel = new BookAppointmentViewModel() { Dates = dates, ServiceId = serviceId, ServiceName = service.Name }; return(View(bookViewModel)); }
public ActionResult AvailableAppointments(int id, DateTime date) { if (ModelState.IsValid) { // get patient var patient = _patientRepository.GetPatient(id); //get clinic info var clinic = _clinicRepository.GetClinic(); // get availabe list of appointmets for selected date var appointments = _appointmentRepository .GetAvailableAppointments(date, clinic.Id); var appointmentsList = new List <SelectListItem>(); foreach (var app in appointments) { appointmentsList.Add(new SelectListItem { Value = app.StartTime, Text = app.StartTime }); } // construct model BookAppointmentViewModel bookAppointmentModel = new BookAppointmentViewModel() { PatientId = patient.Id, FirstName = patient.FirstName, LastName = patient.LastName, DateOfBirth = patient.DateOfBirth, PhoneNumber = patient.PhoneNumber, Date = date, Appointments = appointmentsList }; return(View(bookAppointmentModel)); } return(HttpNotFound()); }
public ActionResult BookAppointment(BookAppointmentViewModel model) { if (ModelState.IsValid && string.IsNullOrWhiteSpace(model.HelperField)) { var sb = new StringBuilder(); sb.AppendFormat("<strong>Kontakt oplysninger</strong>"); sb.AppendFormat("Navn: {0}<br />", model.Name); sb.AppendFormat("Adresse: {0}, {1} {2}<br />", model.Address, model.Zip, model.City); sb.AppendFormat("E-mail: {0}<br />", model.Email); sb.AppendFormat("Telefon: {0}<br /><br />", model.Phone); sb.AppendFormat("Fjernsupport: {0}<br />", model.IsRemoteSupport ? "Ja" : "Nej"); sb.AppendFormat("Beskriv problem: {0}<br />", model.Message); sb.AppendFormat("<p><strong>Besked:</strong> <br />{0}</p>", model.Message); MailMessage message = new MailMessage(); message.To.Add(new MailAddress(ConfigurationManager.AppSettings["ContactAddress"])); message.Sender = new MailAddress(model.Email); message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]); message.Body = sb.ToString(); message.Subject = string.Format("KimDamDev ring op - {0}", model.Name); message.IsBodyHtml = true; TempData["success"] = true; try { smtp.Send(message); } catch (SmtpException smtpEx) { TempData["success"] = false; } } return(CurrentUmbracoPage()); }