public ActionResult Index(int?page, int?bookingId, int pageSize = 5, string patient = "")
        {
            if (Request.HttpMethod != "GET")
            {
                page = 1;
            }

            int pageNumber = (page ?? 1);

            if (bookingId.HasValue)
            {
                bb.EndConsultaion(bookingId.Value);
            }

            ViewData["CountPatients"] = bb.CountMethod().ToString();
            ViewBag.Info        = bb.Consulted();
            ViewData["N_count"] = bb.NotConsulted();

            //List<PatientModel> pm = pb.GetAllPatients();
            var bop = bb.GetAllBookings().Where(x => x.Status == 0 && Convert.ToDateTime(x.start_date).Date.Day == DateTime.Now.Day &&
                                                Convert.ToDateTime(x.start_date).Date.Month == DateTime.Now.Month &&
                                                Convert.ToDateTime(x.start_date).Date.Year == DateTime.Now.Year).ToList();

            List <bookingPatient> bp = bop.OrderBy(x => x.time).Where(x => x.FullName.ToLower().Contains(patient.ToLower()) ||
                                                                      x.Telephone.ToLower().Contains(patient.ToLower()) ||
                                                                      x.Email.ToLower().Contains(patient.ToLower()) ||
                                                                      patient == null).ToList();

            PagedList <bookingPatient> model = new PagedList <bookingPatient>(bp, pageNumber, pageSize);

            return(View("Index", bp.ToPagedList(pageNumber, pageSize)));
        }
예제 #2
0
        public HttpResponseMessage GetUserBookings(string userID)
        {
            if (!bookingBusiness.IsUserIDValid(userID))
            {
                HttpError err = new HttpError("The userID you entered is not valid.");
                return(Request.CreateResponse(HttpStatusCode.BadRequest, err));
            }
            List <Booking> userBookings = bookingBusiness.GetAllBookings(userID);

            return(Request.CreateResponse(HttpStatusCode.OK, userBookings));
        }