public async Task <IActionResult> List(int?categoryId, int?page) { var pageArgument = new PageArgument(page ?? 1, 12); var productPage = await Mediator.Send(new GetProductListQuery(pageArgument, categoryId)); return(View(new ProductListViewModel(productPage, pageArgument))); }
public async Task <IActionResult> Products(int?categoryId, int?page) { var pageArgument = new PageArgument(page ?? 1); var productPage = await Mediator.Send(new GetProductEditListQuery(pageArgument, categoryId)); var categories = await Mediator.Send(new GetCategoryListQuery()); return(View(new ProductEditListViewModel(productPage, pageArgument, categories, categoryId))); }
public ProductEditListViewModel(Page <ProductEdit> productPage, PageArgument pageArgument, IReadOnlyList <Application.Categories.Queries.Category> categories, int?selectedCategoryId) : this() { Products = productPage.Items; PagingInfo = new PagingInfo { CurrentPage = pageArgument.Page, ItemsPerPage = pageArgument.Size, TotalCount = productPage.TotalCount }; Categories = categories; SelectedCategoryId = selectedCategoryId; }
static void Main(string[] args) { List <stu> ls = new List <stu>() { new stu { key = "12", name = "amg" }, new stu { key = "13", name = "tmd" } }; var pa = new PageArgument() { PageIndex = 1, PageSize = 12 }; PageList <stu> ts = (from a in ls select a).AsQueryable().ToPageList(pa); var re = JsonHelper.Serialize(ts); string file = "D:\\log.txt"; for (var i = 0; i < 2; i++) { using (System.IO.StreamWriter sw = new StreamWriter(file, false)) { sw.BaseStream.Seek(0, System.IO.SeekOrigin.End); sw.WriteLine(Utils.GetRandom(9)); } } for (var i = 0; i < 999; i++) { Console.WriteLine(Utils.GetRandom(9)); } // var s = Utils.GetRandom(); DataTable tl = new DataTable(); tl.GetRow(1).GetString("aa"); Console.ReadLine(); }
public GetProductEditListQuery(PageArgument pageArgument, int?categoryId) { PageArgument = pageArgument; CategoryId = categoryId; }
public IEnumerable<CommodityListDto> CommodityList([FromServices]ICommodityService CommodityService,[FromBody]PageArgument page) { return CommodityService.CommodityList(page); }
public ProductListViewModel(Page <Application.Products.Queries.Product> productPage, PageArgument pageArgument) : this() { Products = productPage.Items; PagingInfo = new PagingInfo { CurrentPage = pageArgument.Page, ItemsPerPage = pageArgument.Size, TotalCount = productPage.TotalCount }; }