public ActionResult CreateProjection() { MBProjection mbp = new MBProjection(); mbp.Currencies = new SelectList(projectService.GetCurrencies(countryProg.Id), "Id", "ShortName", mbCurrency.Id); mbp.MasterBudgetCategories = new SelectList(masterBudgetService.GetMBCListNotProjected(countryProg), "Id", "Description"); @ViewBag.FormHeader = Resources.MasterBudgetController_String_NewProjection; @ViewBag.ButtonText = Resources.MasterBudgetController_String_SaveProjection; return(View("CreateProjection", mbp)); }
public ActionResult MBProjections() { List <AnnualCostProjection> mbProjections = masterBudgetService.GetMBProjections(countryProg); List <MBProjection> mbpList = new List <MBProjection>(); MBProjection mbp; foreach (var mbProjection in mbProjections) { mbp = new MBProjection(); mbp.Id = mbProjection.Id; mbp.EntityProjection = mbProjection; mbp.AmountProjected = mbProjection.AmountProjected; mbp.CurrencyId = mbProjection.CurrencyId; mbp.MasterBudgetCategoryId = mbProjection.MasterBudgetCategoryId; mbpList.Add(mbp); } return(View("MBProjections", mbpList)); }
public ActionResult EditProjection(string id) { MBProjection mbp = new MBProjection(); if (id != null) { AnnualCostProjection acp = masterBudgetService.GetMasterBudgetProjectionById(id); mbp.EntityProjection = acp; mbp.Id = acp.Id; mbp.CurrencyId = acp.CurrencyId; mbp.MasterBudgetCategoryId = acp.MasterBudgetCategoryId; mbp.AmountProjected = acp.AmountProjected; mbp.Currencies = new SelectList(projectService.GetCurrencies(countryProg.Id), "Id", "ShortName", mbp.CurrencyId); mbp.MasterBudgetCategories = new SelectList(masterBudgetService.GetMBCListNotProjected(countryProg), "Id", "Description", mbp.MasterBudgetCategoryId); @ViewBag.FormHeader = Resources.MasterBudgetController_String_EditProjection; @ViewBag.ButtonText = Resources.MasterBudgetController_String_UpdateProjection; } return(View("CreateProjection", mbp)); }
public ActionResult SaveProjection(MBProjection mbp) { AnnualCostProjection acp = new AnnualCostProjection(); if (mbp.Id.ToString().Contains("0000-0000")) { acp.MasterBudgetCategoryId = mbp.MasterBudgetCategoryId; acp.CurrencyId = mbp.CurrencyId; acp.AmountProjected = mbp.AmountProjected; acp.CountryProgrammeId = countryProg.Id; masterBudgetService.CreateMBProjection(acp); } else { acp.Id = mbp.Id; acp.CurrencyId = mbp.CurrencyId; acp.AmountProjected = mbp.AmountProjected; acp.CountryProgrammeId = countryProg.Id; masterBudgetService.UpdateMBProjection(acp); } return(MBProjections()); }