public ActionResult Edit(LedgerType ledgerType) { if (ModelState.IsValid) { ledgerRepository.SaveLedgerType(ledgerType); TempData["message"] = string.Format("{0} saved successfully", ledgerType.LedgerTypeName); CacheRepository.RefreshLedgerTypes(); return(RedirectToAction("Index")); } return(View(ledgerType)); }
/// <summary> /// Loads Chart of Accounts in system /// </summary> public void CreateAccountingStructure() { var accountingStructure = GetAccountingStructure(); if (accountingStructure != null && accountingStructure.Count > 0) { foreach (var ledgerTypeStructure in accountingStructure) { LedgerRepository.SaveLedgerType(ledgerTypeStructure.ledgerType); if (ledgerTypeStructure.SampleLedgerHeads != null && ledgerTypeStructure.SampleLedgerHeads.Count > 0) { foreach (var ledgerHeadStructure in ledgerTypeStructure.SampleLedgerHeads) { ledgerHeadStructure.ledgerHead.ParentLedgerTypeId = ledgerTypeStructure.ledgerType.LedgerTypeId; ledgerHeadStructure.ledgerHead.ParentLedgerHeadId = 0; CreateLedgerHead(ledgerHeadStructure); } } } } }