public ActionResult ChangeInformation(int Id) { var campaign = _campaignService.GetCampaignById(Id); _campaignService.CalculateCampaignProfit(Id, false); float[] baseCost = new float[campaign.Products.Count]; int i = 0; if (campaign.Products != null) { foreach (var product in campaign.Products) { if (campaign.ProductCountSold == 0) { baseCost[i++] = _campaignService.CalculateBaseCost(Id, product.Id, 1); } else { baseCost[i++] = _campaignService.CalculateBaseCost(Id, product.Id, campaign.ProductCountSold); } } } var day = campaign.EndDate.Day; var mounth = campaign.EndDate.Month; var year = campaign.EndDate.Year; var model = new CampaignInfViewModel() { CampaignId = campaign.Id, Title = campaign.Title, Alias = campaign.Alias, Target = campaign.ProductCountGoal, Day = Convert.ToInt32(day), Mounth = Convert.ToInt32(mounth), Year = Convert.ToInt32(year), Description = campaign.Description, Currency = campaign.CurrencyRecord, Currencies = _currencyRepository, BackSideByDefault = campaign.BackSideByDefault, Products = campaign.Products.Where(c => c.WhenDeleted == null) }; ViewBag.BaseCosts = baseCost; return(View(model)); }