public ActionResult Ledger(GeneralVoucherPostingViewModel model) { bool status = false; if (!ModelState.IsValid) { FlashMessage.Danger(ModelState.Values.ToString()); return(RedirectToAction("Ledger", "Accounting")); } if (model == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { GeneralVoucherPosting Obj = new GeneralVoucherPosting(); Obj.Amount = model.Amount; Obj.Notes = model.Notes; Obj.LedgerHeadId = model.GeneralLedgerHeadId; Obj.UserID = User.Identity.GetUserId(); Obj.LedgerDate = model.LedgerDate; status = new AccountingDA().InsertGeneralVoucherPosting(Obj); if (status) { FlashMessage.Confirmation("New Ledger Posted"); } else { FlashMessage.Danger("Some error occured!!"); } return(RedirectToAction("Ledger", "Accounting")); } }
public ActionResult Ledger() { GeneralVoucherPostingViewModel model = new GeneralVoucherPostingViewModel(); model.GeneralLedgerHeads = db.GeneralLeaderHeads.Where(a => a.Editable == true).ToList(); return(View(model)); }