public async Task <IActionResult> FilterByAR(DateTime?datepicker, DateTime?timepicker) { List <TableBookingHeader> tableBookingHeaderList = new List <TableBookingHeader>(); if ((datepicker == null && timepicker == null) || (datepicker == null && timepicker != null)) { return(RedirectToAction(nameof(ARBooking))); } else if (datepicker != null && timepicker == null) { tableBookingHeaderList = await _db.TableBookingHeader .Where(t => t.BookStatus == SD.BookTableStatusPending && t.Status != SD.TableStatusCancelled && t.SitInDate.Date == datepicker.Value.Date).OrderBy(t => t.SitInDate).ThenBy(t => t.SitInTime).ToListAsync(); } else if (datepicker != null && timepicker != null) { tableBookingHeaderList = await _db.TableBookingHeader .Where(t => t.BookStatus == SD.BookTableStatusPending && t.Status != SD.TableStatusCancelled && t.SitInDate.Date == datepicker.Value.Date && t.SitInTime == timepicker.Value.TimeOfDay).OrderBy(t => t.SitInDate).ThenBy(t => t.SitInTime).ToListAsync(); } TableARVM objTArm = new TableARVM { tableBookingHeaders = tableBookingHeaderList, StatusMessage = "" }; return(View(nameof(ARBooking), objTArm)); }
public async Task <IActionResult> ARBooking(string message = "") { List <TableBookingHeader> tableBookingHeaderList = await _db.TableBookingHeader .Where(t => t.BookStatus == SD.BookTableStatusPending && t.Status != SD.TableStatusCancelled).OrderBy(t => t.SitInDate).ThenBy(t => t.SitInTime).ToListAsync(); TableARVM objTArm = new TableARVM { tableBookingHeaders = tableBookingHeaderList, StatusMessage = message }; return(View(objTArm)); }