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 <VehicleModelServ> vehicleModelServs = await VehicleModelService.Sort(typeOfSorting); List <VehicleModel> vehicleModels = new List <VehicleModel>(); vehicleModels = mapper.Map <IEnumerable <VehicleModelServ>, List <VehicleModel> >(vehicleModelServs); return(Request.CreateResponse(HttpStatusCode.OK, vehicleModels)); }