Пример #1
0
        public async Task <HttpResponseMessage> Sort(int sort)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid data"));
            }

            TypeOfSorting typeOfSorting = TypeOfSorting.Asc;

            if (sort <= 0)
            {
                typeOfSorting = TypeOfSorting.Desc;
            }
            IEnumerable <VehicleMakeServ> vehicleMakeServs = await VehicleMakeService.Sort(typeOfSorting);

            List <VehicleMake> vehicleMakes = new List <VehicleMake>();

            vehicleMakes = mapper.Map <IEnumerable <VehicleMakeServ>, List <VehicleMake> >(vehicleMakeServs);
            return(Request.CreateResponse(HttpStatusCode.OK, vehicleMakes));
        }