public ActionResult AllDispatches() { var regService = ServiceCreator.GetRegistrationService(); var account = regService.FindAccount(User.Identity.Name); if (account != null) { var service = ServiceCreator.GetDispatchesService(); var activeDispatches = service.GetActiveDispatches(account.Id); var oldDispatches = service.GetInActiveDispatches(account.Id); var model = new DispatchListViewModel(); model.ActiveDispatches = Mapper.Map <List <DispatchViewModel> >(activeDispatches); model.InActiveDispatches = Mapper.Map <List <DispatchViewModel> >(oldDispatches); return(View("DispatchCardList", model)); } else { var model = new DispatchListViewModel(); model.ActiveDispatches = new List <DispatchViewModel>(); model.InActiveDispatches = new List <DispatchViewModel>(); return(View("DispatchCardList", model)); } }
public ActionResult Index(SessionStorage storage, InputMenuViewModel menuView, EnumOperationType operationCategory = EnumOperationType.All, short page = 1, short pageSize = 9, bool asService = false) { if (this.Request.IsAjaxRequest() && this.ModelState.IsValid) { short recordCount; menuView.ReportPeriod = this._bussinesEngage.SyncActualDate(storage, menuView.ReportPeriod); //temp resolve (In some reason default binding not parse json to enum from queryString collection) var typeOfOperation = this.Request.QueryString["operationCategory"] == String.Empty ? (int)EnumOperationType.All : Int32.Parse(this.Request.QueryString["operationCategory"]); var model = new DispatchListViewModel() { Dispatchs = this._bussinesEngage.ShippingsViews((EnumOperationType)typeOfOperation, menuView.ReportPeriod, page, pageSize, out recordCount), PagingInfo = new PagingInfo() { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = recordCount, RoutingDictionary = this.Request.RequestContext.RouteData.Values }, }; //tips: consider use web api mechanism instead of mvc implementation if (asService) { return(this.Json(model, JsonRequestBehavior.AllowGet)); } return(this.PartialView("ShippingSummary", model)); } return(this.View()); }