public ActionResult Create(AccountVM viewModel) { try { // TODO: Add insert logic here if (ModelState.IsValid) { Entities.Account entity = new Entities.Account(); entity.SrNo = viewModel.SrNo; entity.NarrationDetails = viewModel.NarrationDetails; entity.TransactionType = viewModel.TransactionType; entity.PaymentMode = viewModel.PaymentMode; entity.Amount = viewModel.Amount; entity.Balance = viewModel.Balance; entity.TransactionDate = DateTime.Now; entity.Remark = viewModel.Remark == null ? string.Empty : viewModel.Remark; entity.CustomerName = viewModel.CustomerName; entity.BankName = viewModel.BankName; entity.ChqDDNumber = viewModel.ChqDDNumber; entity.ContactNo = viewModel.ContactNo; AccountBAL balObject = new AccountBAL(); balObject.Add(entity, SessionHelper.SchoolId); TempData["Message"] = "Account entry added successfully !!!"; } else { TempData["Error"] = "Some problem while adding account entry !!!"; } } catch { TempData["Error"] = "Some problem while adding account entry !!!"; } return(View(viewModel)); }