public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } string[] elementsOfDate = Input.AppointmentDay.Split('-'); string[] elementsOfTime = Input.AppointmentTime.Split(':'); DateTime appointment = AppointmentLogic.CreateAppointmentDate(elementsOfDate, elementsOfTime); Work work = await AppointmentLogic.MakeAppointmentAsync(appointment, Input.CarId, SubTask, Input.Description); await _emailLogic.SendStatusChangeEmailAsync(work.WorkerUser, work); return(RedirectToPage("./BrowseSubTasks")); }