public void CreateOrEdit(int countryId, DateTime date, int brandId, int soldPieces)
 {
     var monthlyBrandReport = new MonthlyBrandReport();
     monthlyBrandReport.BrandId = brandId;
     monthlyBrandReport.CountryId = countryId;
     monthlyBrandReport.Date = date;
     monthlyBrandReport.SoldPieces = soldPieces;
     _monthlyBrandReportHandler.CreateOrEdit(monthlyBrandReport);
 }
 public void CreateOrEdit(MonthlyBrandReport monthlyBrandReport)
 {
     var monthlyBrandReportToEdit = GetMonthlyBrandReport(monthlyBrandReport.BrandId, monthlyBrandReport.CountryId, monthlyBrandReport.Date);
     if (monthlyBrandReportToEdit == null)
     {
         CreateMonthlyBrandReportItem(monthlyBrandReport);
     }
     else
     {
         monthlyBrandReportToEdit.SoldPieces = monthlyBrandReport.SoldPieces;
         _db.SaveChanges();
     }
 }
 public MonthlyBrandReportViewModel GetMonthlyBrandReport(int countryId, DateTime date)
 {
     var brands = _brandHandler.GetAllBrands();
     var monthlyBrandReports = new List<MonthlyBrandReport>();
     foreach (var brand in brands)
     {
         var monthlyBrandReport = _monthlyBrandReportHandler.GetMonthlyBrandReport(brand.BrandId, countryId, date);
         if (monthlyBrandReport == null) monthlyBrandReport = new MonthlyBrandReport();
         monthlyBrandReport.Brand = brand;
         monthlyBrandReports.Add(monthlyBrandReport);
     }
     var monthlyBrandReportViewModel = new MonthlyBrandReportViewModel()
     {
         MonthlyBrandReports = monthlyBrandReports,
         Date = date,
         CountryId = countryId,
         Countries = _dropDownHelper.GetCountriesListForDropDown(_countryManager.GetAllCountries())
     };
     return monthlyBrandReportViewModel;
 }
 public void CreateMonthlyBrandReportItem(MonthlyBrandReport monthlyBrandReport)
 {
     _db.MonthlyBrandReports.Add(monthlyBrandReport);
     _db.SaveChanges();
 }
 public void CreateOrEdit(MonthlyBrandReport monthlyBrandReport)
 {
     _monthlyBrandReportRepository.CreateOrEdit(monthlyBrandReport);
 }