// GET: TruckLoads public ActionResult Index(TruckLoadSearchModel truckLoadSearchModel) { using (TruckLoadBAL truckLoadBAL = new TruckLoadBAL(ContextInfo)) { truckLoadBAL.PrepareTruckLoadSearchModel(truckLoadSearchModel); } return(View(truckLoadSearchModel)); }
public void PrepareTruckLoadSearchModel(TruckLoadSearchModel truckLoadSearchModel) { try { truckLoadSearchModel.StatusesList = dbContext.TruckLoadStatuses. Select(x => new { x.Id, x.Name, }).ToList().OrderBy(x => x.Name).Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); } catch (Exception ex) { base.HandleError(truckLoadSearchModel, CommonLayer.LookUps.ErrorType.Critical, ex); } }