public WorkerMainMenu() { InitializeComponent(); workerApi = new WorkerApiClient(); appointmentApi = new AppointmentApiClient(); }
public async Task <ActionResult> Details(int id) { appointmentApi = new AppointmentApiClient(); Appointment appointment = await appointmentApi.GetAppointment(id); return(View(appointment)); }
public OwnerMainMenu() { InitializeComponent(); ownerApi = new OwnerApiClient(); appointmentApi = new AppointmentApiClient(); hairSalonApi = new HairSalonApiClient(); }
public AppointmentPanel(Appointment appointment) { InitializeComponent(); appointmentApi = new AppointmentApiClient(); this.appointment = appointment; SetAppointmentValues(); }
public async Task <ActionResult> Edit(int id) { appointmentApi = new AppointmentApiClient(); hairSalonApi = new HairSalonApiClient(); Appointment appointment = await appointmentApi.GetAppointment(id); HairSalon hairSalon = await hairSalonApi.GetHairSalon(appointment.HairSalonId); List <SelectListItem> workers = new List <SelectListItem>(); List <SelectListItem> services = new List <SelectListItem>(); List <SelectListItem> methodsOfPayment = new List <SelectListItem>(); foreach (var worker in hairSalon.Workers) { workers.Add(new SelectListItem() { Value = worker.Id.ToString(), Text = worker.GetFullName() }); } foreach (var hairSalonService in hairSalon.HairSalonServices) { services.Add(new SelectListItem() { Value = hairSalonService.ServiceId.ToString(), Text = hairSalonService.Service.ToString() }); } foreach (var hairSalonMethodsOfPayment in hairSalon.HairSalonMethodsOfPayment) { methodsOfPayment.Add(new SelectListItem() { Value = hairSalonMethodsOfPayment.MethodOfPaymentId.ToString(), Text = hairSalonMethodsOfPayment.MethodOfPayment.ToString() }); } AppointmentUpdateVM appointmentUpdateVM = new AppointmentUpdateVM() { Date = appointment.Date, Time = appointment.Time, Workers = new SelectList(workers, "Value", "Text"), SelectedWorker = new SelectListItem() { Value = appointment.Worker.Id.ToString(), Text = appointment.Worker.GetFullName() }, AvailableServices = new SelectList(services, "Value", "Text"), MethodsOfPayment = new SelectList(methodsOfPayment, "Value", "Text"), HairSalonId = hairSalon.Id }; return(View(appointmentUpdateVM)); }
public AddNewAppointment(Worker worker) { InitializeComponent(); ls = new LoadingScreen(); hairSalonServicesApi = new HairSalonServicesApiClient(); appointmentApi = new AppointmentApiClient(); registeredUserApi = new RegisteredUserApiClient(); hairSalonMethodsOfPaymentApi = new HairSalonMethodsOfPaymentApiClient(); this.worker = worker; }
public async Task <ActionResult> Cancel(int id) { appointmentApi = new AppointmentApiClient(); AppointmentUpdateVM appointmentUpdateVM = new AppointmentUpdateVM() { IsCompleted = true }; await appointmentApi.UpdateAppointment(id, appointmentUpdateVM); return(RedirectToAction("Details", "Appointment", new { id })); }
public async Task <ActionResult> UserProfile() { RegisteredUser registeredUser = (RegisteredUser)Session["RegisteredUser"]; appointmentApi = new AppointmentApiClient(); favoriteHairSalonApi = new FavoriteHairSalonApiClient(); reviewApi = new ReviewApiClient(); List <Appointment> appointments = await appointmentApi.GetAppointmentsByRegisteredUser(registeredUser.Id); ViewBag.Appointments = appointments; List <FavoriteHairSalons> favoriteHairSalons = await favoriteHairSalonApi.GetFavoriteHairSalonsByRegisteredUser(registeredUser.Id); ViewBag.FavoriteHairSalons = favoriteHairSalons; List <Review> reviews = await reviewApi.GetReviewsByRegisteredUser(registeredUser.Id); ViewBag.Reviews = reviews; return(View(registeredUser)); }
public async Task <ActionResult> Create(AppointmentInsertVM appointmentInsertVM) { appointmentApi = new AppointmentApiClient(); bool appointmentIsNotAvailable = false; if (ModelState.IsValid) { appointmentIsNotAvailable = await appointmentApi.CheckAppointmentAvailability(new CheckAvailabilityVM() { Date = appointmentInsertVM.Date, Time = appointmentInsertVM.Time, WorkerId = int.Parse(appointmentInsertVM.SelectedWorkerId) }); } if (!appointmentIsNotAvailable) { if (ModelState.IsValid) { RegisteredUser registeredUser = (RegisteredUser)Session["RegisteredUser"]; appointmentInsertVM.RegisteredUser = registeredUser; await appointmentApi.InsertAppointmentByUser(appointmentInsertVM); return(RedirectToAction("UserProfile", "Account")); } } else { ViewBag.Unavailable = "unavailable"; } hairSalonApi = new HairSalonApiClient(); HairSalon hairSalon = await hairSalonApi.GetHairSalon(appointmentInsertVM.HairSalonId.Value); List <SelectListItem> workers = new List <SelectListItem>(); List <SelectListItem> services = new List <SelectListItem>(); List <SelectListItem> methodsOfPayment = new List <SelectListItem>(); foreach (var worker in hairSalon.Workers) { workers.Add(new SelectListItem() { Value = worker.Id.ToString(), Text = worker.GetFullName() }); } foreach (var hairSalonService in hairSalon.HairSalonServices) { services.Add(new SelectListItem() { Value = hairSalonService.ServiceId.ToString(), Text = hairSalonService.Service.ToString() }); } foreach (var hairSalonMethodsOfPayment in hairSalon.HairSalonMethodsOfPayment) { methodsOfPayment.Add(new SelectListItem() { Value = hairSalonMethodsOfPayment.MethodOfPaymentId.ToString(), Text = hairSalonMethodsOfPayment.MethodOfPayment.ToString() }); } AppointmentInsertVM newAppointmentInsertVM = new AppointmentInsertVM() { Date = appointmentInsertVM.Date, Time = appointmentInsertVM.Time, HairSalonId = appointmentInsertVM.HairSalonId.Value, Workers = new SelectList(workers, "Value", "Text"), AvailableServices = new SelectList(services, "Value", "Text"), MethodsOfPayment = new SelectList(methodsOfPayment, "Value", "Text") }; return(View(newAppointmentInsertVM)); }