public IEnumerable <NationalCasesDataModel> Get([FromQuery] Metrics metrics) { return(_covidBLService.GetCountOfCasesForAllNations(metrics.ToBLLMetrics()).Select(Item => new NationalCasesDataModel() { Count = Item.Count, Country = Item.Country }).ToList()); }
public IEnumerable <NationalCasesDataModel> Get([FromUri] Metrics metrics) { HttpStatusCode statusCode = HttpStatusCode.BadRequest; var errorResponse = Request.CreateErrorResponse(statusCode, "Resource not found!"); return((metrics == Metrics.CONFIRMED_CASES) ? (_covidBLService.GetCountOfCasesForAllNations(Metrics.CONFIRMED_CASES).Select(Item => new NationalCasesDataModel() { Count = Item.Count, Country = Item.Country }).ToList()) : (metrics == Metrics.DEATHS) ? (_covidBLService.GetCountOfCasesForAllNations(Metrics.DEATHS).Select(Item => new NationalCasesDataModel() { Count = Item.Count, Country = Item.Country }).ToList()) : (metrics == Metrics.RECOVERIES) ? _covidBLService.GetCountOfCasesForAllNations(Metrics.RECOVERIES).Select(Item => new NationalCasesDataModel() { Count = Item.Count, Country = Item.Country }).ToList() : throw new HttpResponseException(errorResponse));; }