public async Task <IActionResult> Create() { var actualUser = await _userHelper.GetUserByEmailAsync(User.Identity.Name); var customer = _context.Customers.Where(c => c.User.Id == actualUser.Id); if (customer == null) { return(NotFound()); } var model = new AppViewModel { Doctors = _combosHelper.GetComboDoctors(), Customers = _combosHelper.GetComboCustomers(), Pets = _combosHelper.GetComboPets(0), ServiceTypes = _combosHelper.GetComboServiceTypes() }; return(View(model)); }
public AppViewModel ToAppointmentViewModel(App appointment) { return(new AppViewModel { Id = appointment.Id, AppDate = appointment.AppDate, User = appointment.User, Customer = appointment.Customer, CustomerId = appointment.Customer.Id, Customers = _combosHelper.GetComboCustomers(), Doctor = appointment.Doctor, DoctorId = appointment.Doctor.Id, Doctors = _combosHelper.GetComboDoctors(), Pet = appointment.Pet, PetId = appointment.Pet.Id, Pets = _combosHelper.GetComboPets(0), serviceType = appointment.serviceType, ServiveTypeId = appointment.serviceType.Id, ServiceTypes = _combosHelper.GetComboServiceTypes(), }); }