Exemple #1
0
 public JsonResult ListAll([FromBody] SearchViewModel model)
 {
     string[][] parameters = model.GetParameters();
     return(new JsonResult(Manager.GetVehiclesByParameter(parameters))
     {
         StatusCode = (int)HttpStatusCode.OK
     });
 }
 public JsonResult Closest([FromBody] SearchViewModel model)
 {
     string[][] parameters = model.GetParameters();
     if (model.Latitude == null || model.Longitude == null)
     {
         return new JsonResult("Latitude and Longitude are obligatory requirements")
                {
                    StatusCode = (int)HttpStatusCode.BadRequest
                }
     }
     ;
     return(new JsonResult(Manager.FindDealersOrderedByDistance(parameters, ((double)model.Latitude, (double)model.Longitude)).FirstOrDefault())
     {
         StatusCode = (int)HttpStatusCode.OK
     });