public IActionResult Index() { var currRoleId = partnerManager.GetCurrentUserRole(this.HttpContext); var permission = partnerActivity.GetPartAct("MoneyTransfer.Adjustment.Query", currRoleId); if (permission == null || permission.Details == null) { toastNotification.AddErrorToastMessage("ليس لديك الصلاحيات الكافية ", new ToastrOptions { Title = "" }); return(Redirect(Request.Headers["Referer"].ToString())); } var model = new AdjustmentQueryDto(); model.StartDate = DateTime.Today.AddMonths(-1); model.EndDate = DateTime.Today; model.Paging.PageNo = 1; model.Paging.PageSize = 50; return(View(model)); }
public IActionResult Index(AdjustmentQueryDto model, [FromQuery(Name = "direction")] string direction) { var currRoleId = partnerManager.GetCurrentUserRole(this.HttpContext); var permission = partnerActivity.GetPartAct("MoneyTransfer.Adjustment.Query", currRoleId); if (permission == null || permission.Details == null) { toastNotification.AddErrorToastMessage("ليس لديك الصلاحيات الكافية ", new ToastrOptions { Title = "" }); return(Redirect(Request.Headers["Referer"].ToString())); } ModelState.Clear(); if (direction == "pre" && model.Paging.PageNo > 1) { model.Paging.PageNo -= 1; } if (direction == "next") { model.Paging.PageNo += 1; } var results = new AdjustmentRepo(db, partnerManager, partnerActivity).GetListWithPaging(model.Id, model.MoneyTransferId, model.CreatedById, model.PartnerId, model.StartDate, model.EndDate, model.Paging); if (results != null) { model.Paging.Count = new AdjustmentRepo(db, partnerManager, partnerActivity).GetCount(model.Id, model.MoneyTransferId, model.CreatedById, model.PartnerId, model.StartDate, model.EndDate); } else { model.Paging.Count = 0; } model.Results = results; return(View(model)); }