public ActionResult SearchImage(string date) { try { ConvertDate convertDate = GetDate(date); if (convertDate.IsValid) { string apiPAram = GetParam(convertDate.Value); string response = GetMethodApi(apiPAram); if (!string.IsNullOrEmpty(response)) { MarsRoverPhoto marsRoverPhoto = JsonConvert.DeserializeObject <MarsRoverPhoto>(response); return(View("Images", marsRoverPhoto)); } else { return(JsonResult(response)); } } else { return(JsonResult("Invalid date format")); } } catch (Exception e) { return(JsonResult(e.Message)); } }
static string GetImagePath(MarsRoverPhoto photo) { return(Path.Combine(Path.GetTempPath(), "NasaPhotos", "MarsRovers", photo.Rover.Name, photo.Camera.Name, photo.EarthDate)); }