/// <summary> /// Creates model which contains the appointments which potential buyer /// requested for property. The appointments are sorted by descending /// based on their creation date. /// </summary> public MyAppointmentsViewModel Build(string buyerUserId) { var appointmentStates = _context.Properties .Where(p => p.Appointments.Any(a => a.BuyerUserId == buyerUserId)) .SelectMany(p => p.Appointments.Where(a => a.BuyerUserId == buyerUserId) .Select(a => new { p.PropertyType, p.StreetName, a.Date, a.Status })) .OrderByDescending(a => a.Date) .ToList() .Select(a => new PropertyAppointmentState() { AppointmentDate = a.Date, AppointmentStatus = a.Status, PropertyType = a.PropertyType, PropertyStreetName = a.StreetName }) .ToList(); var viewModel = new MyAppointmentsViewModel() { Appointments = appointmentStates }; return(viewModel); }
public JsonResult GetPatientScheduleAppointments() { var currentUserId = Convert.ToInt32(Session["currentUserId"].ToString()); var data = MyAppointmentsViewModel.MyTodayAppointments(currentUserId); return(Json(new { result = data }, JsonRequestBehavior.AllowGet)); }
public MyAppointmentsViewModel Build(string userId) { var appts = _context.Appointments .Where(p => p.BuyerUserId == userId) .Include(x => x.Property); var appointments = appts .Select(app => new MyAppointmentViewModel() { Appointment = new AppointmentViewModel() { BuyerUserId = app.BuyerUserId, CreatedAt = app.CreatedAt, Date = app.Date, Id = app.Id, Status = app.Status, UpdatedAt = app.UpdatedAt }, Property = app.Property }).ToList(); var apptsVM = new MyAppointmentsViewModel() { MyAppointments = appointments }; return(apptsVM); }
public MyAppointments() { InitializeComponent(); viewmodel = new MyAppointmentsViewModel(); BindingContext = viewmodel; //subscribes(listens) for the item being sent from doctorlistViewModel MessagingCenter.Subscribe <DoctorListView, string>(this, _BasicString, (sender, specialArgs) => { //replaces string, using the OnPropertyChanged method in viewmodel viewmodel.MyAppointmentsViewModelText = specialArgs; }); }
public MyAppointmentsPage() { InitializeComponent(); BindingContext = new MyAppointmentsViewModel(); }
public JsonResult GetPatientPrescriptionDetail(int patientId) { var data = MyAppointmentsViewModel.myPrescriptionDetail(patientId); return(Json(new { result = data }, JsonRequestBehavior.AllowGet)); }