// GET: Employee public ActionResult Index(int page = 1) { var data = dbContext.CatagoryBills.OrderBy(x => x.NameCatagory).Skip((page - 1)*PageSize).Take(PageSize).ToList(); int totalPages = (int)Math.Ceiling((decimal)dbContext.CatagoryBills.Count() / PageSize); ListPersonViewModel<CatagoryBill> list = new ListPersonViewModel<CatagoryBill> { listPerson = data, TotalPages = totalPages }; return Json(list, JsonRequestBehavior.AllowGet); }
// GET: Employee public ActionResult GetListCust(int page = 1) { var data = dbContext.Persons.OfType<Partner>().Where(x => ((Partner)x).Type == TypePartner.Customer) .OrderBy(x => x.Name).Skip((page - 1)*PageSize).Take(PageSize).ToList(); int totalPages = (int)Math.Ceiling((decimal)dbContext.Persons.OfType<Partner>().Where(x => ((Partner)x).Type == TypePartner.Customer).Count() / PageSize); ListPersonViewModel<Partner> list = new ListPersonViewModel<Partner> { listPerson = data, TotalPages = totalPages }; return Json(list, JsonRequestBehavior.AllowGet); }
public ActionResult List() { return(View(ListPersonViewModel.GetAll())); }
public ActionResult Index(int page = 1) { IEnumerable<Employee> empList = dbContext.Persons.OfType<Employee>().OrderBy(x => x.Name).Skip(PageSize*(page - 1)).Take(PageSize).ToList(); int totalPages = (int)Math.Ceiling((decimal)dbContext.Persons.OfType<Employee>().Count() / PageSize); ListPersonViewModel<Employee> data = new ListPersonViewModel<Employee> { listPerson = empList, TotalPages = totalPages }; return Json(data, JsonRequestBehavior.AllowGet); }
public ActionResult GetListRec(int page = 1) { var data = dbContext.Bills.Where(x => x.Type == TypeBill.Receipt).Include(x => x.Person).Include(x => x.CatagoryBill) .OrderBy(x => x.DateBill).Skip((page - 1) * PageSize).Take(PageSize).ToList(); int totalPages = (int)Math.Ceiling((decimal)dbContext.Bills.Where(x => x.Type == TypeBill.Receipt).Count() / PageSize); foreach (var item in data) { if (item.CatagoryBill != null) { item.CatagoryBill.Bills = null; } if (item.Person != null) { item.Person.Bills = null; } } ListPersonViewModel<Bill> list = new ListPersonViewModel<Bill> { TotalPages = totalPages, listPerson = data }; return Json(list, JsonRequestBehavior.AllowGet); }