public ActionResult ReciptPlan(LoanReciptPlanWithDetailViewModel loanReciptPlanDetail) { var userID = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).UserProfileID; if (ModelState.IsValid && loanReciptPlanDetail!=null) { var loanReciptPlanModel = new LoanReciptPlanDetail() { LoanReciptPlanID = loanReciptPlanDetail.LoanReciptPlanID, HubID = loanReciptPlanDetail.HubID, //MemoReferenceNumber = loanReciptPlanDetail.MemoRefrenceNumber, RecievedQuantity = loanReciptPlanDetail.Amount, RecievedDate = DateTime.Today, ApprovedBy = userID }; _loanReciptPlanDetailService.AddRecievedLoanReciptPlanDetail(loanReciptPlanModel); return RedirectToAction("Detail", new {id = loanReciptPlanDetail.LoanReciptPlanID}); } ViewBag.HubID = new SelectList(_commonService.GetAllHubs(), "HubID", "Name"); return View(loanReciptPlanDetail); }
public ActionResult ReciptPlan(int id) { var loanReciptPlan = _loanReciptPlanService.FindById(id); if (loanReciptPlan==null) { return HttpNotFound(); } ViewBag.HubID = new SelectList(_commonService.GetAllHubs(), "HubID", "Name"); var loanReciptPlanViewModel = new LoanReciptPlanWithDetailViewModel() { LoanReciptPlanID = id, TotalAmount = loanReciptPlan.Quantity, Remaining = _loanReciptPlanDetailService.GetRemainingQuantity(id) }; ViewBag.Errors = "Out of Quantity! The Remaining Quantity is:"; return View(loanReciptPlanViewModel); }