public ActionResult Edit(string id) { AccountCreateViewModel model = AccountHelper.GetAccount(id); List <AccountValueViewModel> accountValues = AccountValueHelper.GetAccountValuesbyChartId(Convert.ToInt64(id), SessionHelper.SOBId); if (accountValues.Any()) { throw new Exception("Edit Error", new Exception { Source = "Accounts having values cannot be edited" }); } List <Core.Entities.CodeCombinition> codeCombinitions = CodeCombinationHelper.GetCodeCombinations(model.SOBId, AuthenticationHelper.CompanyId.Value); if (codeCombinitions.Any()) { throw new Exception("Edit Error", new Exception { Source = "Accounts having code combinitions cannot be edited" }); } model.SOBId = SessionHelper.SOBId; return(View(model)); }
public ActionResult Delete(string id) { List <AccountValueViewModel> accountValues = AccountValueHelper.GetAccountValuesbyChartId(Convert.ToInt64(id), SessionHelper.SOBId); if (accountValues.Any()) { throw new Exception("Delete Error", new Exception { Source = "Accounts having values cannot be deleted" }); } List <Core.Entities.CodeCombinition> codeCombinitions = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value); if (codeCombinitions.Any()) { throw new Exception("Delete Error", new Exception { Source = "Accounts having code combinitions cannot be edited" }); } AccountHelper.Delete(id); return(RedirectToAction("Index")); }