public List <phieuxuat> GetAll(phieuxuatSearch s) { using (CTyPHSachEntities db = new CTyPHSachEntities()) { var model = (from a in db.DeliveryNotes where (s.nguoigiao == null || a.receiverName.Contains(s.nguoigiao)) && (s.id == null || a.DeliveryNoteID == s.id) && (s.id_dl == null || a.AgencyID == s.id_dl) && (s.nguoinhan == null || a.deliverName.Contains(s.nguoinhan)) && (s.tientu == null || a.totalPrice >= s.tientu) && (s.tienden == null || a.totalPrice <= s.tienden) && (s.ngaytu == null || a.deliverDateCreated >= s.ngaytu) && (s.ngayden == null || a.deliverDateCreated <= s.ngayden) select new phieuxuat() { id = a.DeliveryNoteID, ngayxuat = a.deliverDateCreated, nguoigia = a.deliverName, nguoitao = a.receiverName, hanthanhtoan = a.endeliverdate, id_dl = a.AgencyID, giatri = a.totalPrice, dl = (from b in db.Agencies where a.AgencyID == b.AgencyID select new daily() { id = b.AgencyID, name = b.agencyName }).FirstOrDefault() }).ToList(); return(model); } }
// GET: PhieuXuat public ActionResult Index(phieuxuatSearch s, int?page, int pagezise = 10) { loadnxb(); int pageNumber = (page ?? 1); ViewBag.s = s; var model = PhieuxuatService.GetAllBooks(s).ToPagedList(pageNumber, pagezise); if (Request.IsAjaxRequest()) { return(PartialView("list", model)); } return(View(model)); }
public static List <phieuxuat> GetAllBooks(phieuxuatSearch s) { return(repository.GetAll(s)); }