Ejemplo n.º 1
0
 public IEnumerable <SalesReport> GetTopNSalesReportsPerFile(DealershipFile dealershipFile, int topNumbers)
 {
     try
     {
         IEnumerable <SalesReport> salesReports = _salesReportRepository.GetTopNSalesReportsPerDealershipAndFile(dealershipFile.Dealership,
                                                                                                                 dealershipFile.FileName
                                                                                                                 , topNumbers);
         return(salesReports);
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Can't find sales report list", ex);
     }
 }
 public static DealershipFile ConvertToDealershipFile(this SalesReport salesReport)
 {
     try
     {
         DealershipFile dealershipFile = new DealershipFile();
         dealershipFile.Dealership = salesReport.DealershipName;
         dealershipFile.FileName   = salesReport.FileName;
         return(dealershipFile);
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Could not create Dealer shipFile ", ex);
     }
 }
 public IActionResult GetDealerShipSalesReport([FromQuery(Name = "dealership")] string dealershipName, [FromQuery(Name = "file")] string fileName)
 {
     try
     {
         DealershipFile dealershipFile = new DealershipFile()
         {
             Dealership = dealershipName.Replace("\"", ""),
             FileName   = fileName.Replace("\"", "")
         };
         var result = _salesReportService.GetTopNSalesReportsPerFile(dealershipFile, 10);
         if (result.Any())
         {
             return(Ok(result));
         }
         return(NotFound());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }