public List<YearlyBrandReport> GetYearlyBrandReports(int countryId, int brandId, int year) { var yearlyBrandReports = new List<YearlyBrandReport>(); for (int i = 1; i <= 12; i++) { var yearlyBrandReport = _yearlyBrandReportHandler.GetYearlyBrandReport(brandId, countryId, i, year); if (yearlyBrandReport == null) yearlyBrandReport = new YearlyBrandReport(); yearlyBrandReport.Month = i; yearlyBrandReports.Add(yearlyBrandReport); } return yearlyBrandReports.OrderByDescending(p=>p.Month).ToList(); }
public void CreateOrEdit(int countryId, int brandId, int year, int month, int plannedPieces, int soldPieces) { var yearlyBrandReport = new YearlyBrandReport() { CountryId = countryId, BrandId = brandId, Year = year, Month = month, PlannedPieces = plannedPieces, SoldPieces = soldPieces }; _yearlyBrandReportHandler.CreateOrEdit(yearlyBrandReport); }
public void CreateOrEdit(YearlyBrandReport yearlyBrandReport) { var yearlyBrandReportToEdit = GetYearlyBrandReport(yearlyBrandReport.BrandId, yearlyBrandReport.CountryId, yearlyBrandReport.Month, yearlyBrandReport.Year); if (yearlyBrandReportToEdit == null) { CreateYearlyBrandReportItem(yearlyBrandReport); } else { yearlyBrandReportToEdit.PlannedPieces = yearlyBrandReport.PlannedPieces; yearlyBrandReportToEdit.SoldPieces = yearlyBrandReport.SoldPieces; _db.SaveChanges(); } }
public void CreateOrEdit(YearlyBrandReport yearlyBrandReport) { _yearlyBrandReportRepository.CreateOrEdit(yearlyBrandReport); }
private void CreateYearlyBrandReportItem(YearlyBrandReport yearlyBrandReport) { _db.YearlyBrandReports.Add(yearlyBrandReport); _db.SaveChanges(); }