// // GET: /manageOrder/ public ActionResult Index(String cn, string inv, string dc, string dm, Double?t, OrderStates?s, int PageSize = PAGE_SIZE, int page = 1, Sorts sb = Sorts.OrderIdUp, Int64 Id = 0) { page = page > 1 ? page : 1; PageSize = PageSize > 0 ? PageSize : PAGE_SIZE; DateTime?DateCreation; DateTime?DateModified; if (!String.IsNullOrWhiteSpace(dc)) { DateCreation = DateTime.ParseExact(dc, "dd/MM/yyyy", CultureInfo.InvariantCulture); } else { DateCreation = null; } if (!String.IsNullOrWhiteSpace(dm)) { DateModified = DateTime.ParseExact(dm, "dd/MM/yyyy", CultureInfo.InvariantCulture); } else { DateModified = null; } List <OrderDTO> orderDTOs = _orderService.Filter(Id, s, cn, t, DateCreation, DateModified, sb, inv, CurrentLanguage, CurrentCurrency); Mapper.Initialize(c => c.CreateMap <OrderDTO, OrderVM>()); List <OrderVM> orderVMs = Mapper.Map <List <OrderDTO>, List <OrderVM> >(orderDTOs); ManageOrderVM orders = new ManageOrderVM { Orders = orderVMs.ToPagedList(page, PageSize), filters = new OrderFiltersVM { Id = Id, PageNum = page, PageSize = PageSize, SortBy = sb, Status = s, Total = t, UserId = cn, CreationDate = DateCreation, DateModified = DateModified, Invoice = inv } }; return(View(orders)); }
public ActionResult Index(String cn, string inv, Double?t, string dc, string dm, OrderStates?s, Sorts sb = Sorts.OrderIdUp, int page = 1, int PageSize = PAGE_SIZE, Int64 Id = 0) { //send values of filters to service DateTime?DateCreation; DateTime?DateModified; if (!String.IsNullOrWhiteSpace(dc)) { DateCreation = DateTime.ParseExact(dc, "dd/MM/yyyy", CultureInfo.InvariantCulture); } else { DateCreation = null; } if (!String.IsNullOrWhiteSpace(dm)) { DateModified = DateTime.ParseExact(dm, "dd/MM/yyyy", CultureInfo.InvariantCulture); } else { DateModified = null; } List <OrderDTO> orderDTOs = _orderService.Filter(Id, s, cn, t, DateCreation, DateModified, sb, inv, CurrentLanguage, CurrentCurrency); ManageOrderVM orders = new ManageOrderVM(); Mapper.Initialize(c => c.CreateMap <OrderDTO, OrderVM>()); List <OrderVM> ordersVM = Mapper.Map <List <OrderDTO>, List <OrderVM> >(orderDTOs); OrderFiltersVM filters = new OrderFiltersVM(); filters.Id = Id; filters.PageNum = page; filters.PageSize = PageSize; filters.SortBy = sb; filters.Status = s; filters.Total = t; filters.UserId = cn; filters.CreationDate = DateCreation; filters.DateModified = DateModified; filters.Invoice = inv; orders.filters = filters; orders.Orders = ordersVM.ToPagedList(page, PageSize); return(View(orders)); }