public static void Main(string[] args) { //BuildWebHost(args).Run(); var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var context = services.GetRequiredService <ApplicationContext>(); DoctorsData.Initialize(context); var userManager = services.GetRequiredService <UserManager <User> >(); var rolesManager = services.GetRequiredService <RoleManager <IdentityRole> >(); UsersData.InitializeAsync(context, rolesManager, userManager); DoctorsData.Initialize(context); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred while seeding the database."); } } host.Run(); }
public static DoctorsData getDoctorDetails(int id) { List <DoctorsData> doctors = AppointmentService.DoctorsDatas; DoctorsData filteredItems = doctors.Where(i => i.Id.Equals(id)).FirstOrDefault(); return(filteredItems); }
public DoctorsData getDoctorDetails(int id) { List <DoctorsData> doctors = this.DoctorsDatas; DoctorsData filteredItems = doctors.Where(i => i.Id.Equals(id)).FirstOrDefault(); return(filteredItems); }
public static string getAvailability(DoctorsData data) { var workDays = data.WorkDays; List <WorkDaysData> filteredData = workDays.Where(item => item.Enable.Equals(true)).ToList(); var result = filteredData.Select(item => item.Day.Substring(0, 3).ToUpper()); var resultItem = String.Join(",", result); string.Concat("-", resultItem); return(resultItem.ToString());; }
public ActionResult DoctorList() { if (Session["userId"] == null) { return(Redirect("~")); } DoctorsData doctorsData = new DoctorsData(); List <DoctorFee> doctorList = doctorsData.GetAllDoctorsList(); return(View(doctorList)); }
public ActionResult DoctorsList(AppointmentViewModel model) { if (Session["userId"] == null) { return(Redirect("~")); } DoctorsData doctorsData = new DoctorsData(); ScheduleBasedAppointmentManagement scheduleBasedAppointment = new ScheduleBasedAppointmentManagement(); var scheduleBasedAvailability = new List <DoctorAvailability>(); scheduleBasedAvailability = scheduleBasedAppointment.GetAvailability(model.SelectedDate); var doctorList = new List <DoctorsListViewModel>(); var doctorsAvailabilityList = doctorsData.GetDoctorsList(); doctorsAvailabilityList = ( from o in doctorsAvailabilityList orderby o.DoctorId, o.Fee descending group o by o.DoctorId into g select g.First() ).ToList(); var doctorSpecilizationList = doctorsData.GetDoctorSpecilizationList(); foreach (var item in doctorsAvailabilityList) { var doctorData = new DoctorsListViewModel(); doctorData.FirstName = item.Doctor.FirstName; doctorData.LastName = item.Doctor.LastName; doctorData.Email = item.Doctor.Email; doctorData.DoctorId = item.DoctorId; foreach (var scheduleAvailability in scheduleBasedAvailability) { if (scheduleAvailability.Users.Id == item.DoctorId) { doctorData.Availability = true; break; } } foreach (var doctorSpecilization in doctorSpecilizationList) { if (item.DoctorId == doctorSpecilization.UserId) { doctorData.Specialization.Add(doctorSpecilization.Specialization.Name.ToString()); } } doctorData.SelectedDate = model.SelectedDate; doctorList.Add(doctorData); } return(View(doctorList)); }