Exemplo n.º 1
0
        private List <SelectListItem> GetVehicleModel()
        {
            VehicleModelFilter filter = new VehicleModelFilter();

            filter.Name = "";
            return(VehicleModelService.Get(filter).Select(b => new SelectListItem(b.Name, b.Id.ToString())).ToList());
        }
Exemplo n.º 2
0
        public ActionResult Index(int?page, string sort, string search)
        {
            var sortPar = new Parameters.SortParameters()
            {
                Sort = sort
            };
            var filterPar = new Parameters.FilterParameters()
            {
                Search = search
            };
            var pagePar = new Parameters.PageParameters()
            {
                Page = page ?? 1, PageSize = 10
            };
            var vehicleModel = model.Get(sortPar, filterPar, pagePar);

            ViewBag.sort   = sort;
            ViewBag.model  = sort == "model_desc" ? "model" : "model_desc";
            ViewBag.make   = sort == "make_desc" ? "make" : "make_desc";
            ViewBag.abrv   = sort == "abrv_desc" ? "abrv" : "abrv_desc";
            ViewBag.search = search;
            var list = Mapper.Map <IEnumerable <VehicleModel>, IEnumerable <VehicleModelView> >(vehicleModel);

            return(View(new StaticPagedList <VehicleModelView>(list, vehicleModel.GetMetaData())));
        }
        public ActionResult Index()
        {
            VehicleModelFilter filter = new VehicleModelFilter();

            filter.Name = "";
            var items = VehicleModelService.Get(filter);

            return(View(items));
        }
Exemplo n.º 4
0
        public async Task <HttpResponseMessage> Get(int pageIndex = 1, int pageSize = 10, string filter = "", TypeOfSorting sort = TypeOfSorting.Asc)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid data"));
            }

            PageResult <VehicleModel> result = new PageResult <VehicleModel>(pageIndex, pageSize, sort, filter);

            if (result.Paging.Invalidete())
            {
                var url = Request.RequestUri.GetLeftPart(UriPartial.Authority) + "/" + baseRoute;
                result.GenerateNextPage(url);
                IEnumerable <VehicleModelServ> vehicleModels = await VehicleModelService.Get(result.Filtering, result.Paging, result.Sorting);

                result.Results = mapper.Map <IEnumerable <VehicleModelServ>, List <VehicleModel> >(vehicleModels);
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Exemplo n.º 5
0
 private List <SelectListItem> GetVehicleModels()
 {
     return(VehicleModelService.Get(new VehicleModelFilter()).Select(m => new SelectListItem($"{m.VehicleBrandName} {m.Name}", m.Id.ToString())).ToList());
 }
 // GET: VehicleModel/Details/5
 public ActionResult Details(Guid?id)
 {
     return(View(_serviceModel.Get(id)));
 }