public ActionResult HostelTransaction(StudentSearchViewModel userInput) { TransactionHelper helper = new TransactionHelper(); // make an attempt to find the student and display the form, if not possible, show error HostelTransactionViewModel viewModel = helper.ConstructViewModelForHostelTransaction(userInput.bid); if (viewModel != null) { // generate the list of account heads to be displayed and add it to the view bag ViewBag.acHeadList = new SelectList(helper.GetAccountHeads(), "id", "val"); // generate the list of payment types to be displayed and add it to the view bag ViewBag.paymentTypeList = new SelectList(helper.GetPaymentTypes(false), "id", "val"); //generate the list of academic years to be displayed and add it to the view bag ViewBag.academicYearList = new SelectList(helper.GetValidAcademicYears(viewModel.year), DateTime.Now.Year + ""); // display the form return(PartialView("_AddHostelTransation", viewModel)); } else { return(Content("Student not found")); } }
public ActionResult EditHostelTransaction(HostelTransactionViewModel userInput) { if (!ModelState.IsValid) { return(View(userInput)); } TransactionHelper helper = new TransactionHelper(); helper.EditHotelTransaction(userInput); TempData["bid"] = userInput.bid; return(RedirectToAction("HostelTransaction")); }
public ActionResult EditHostelTransaction(int id) { TransactionHelper helper = new TransactionHelper(); HostelTransactionViewModel viewModel = helper.GetHotelTransactionViewModel(id); // generate the list of account heads to be displayed and add it to the view bag ViewBag.acHeadList = new SelectList(helper.GetAccountHeads(), "id", "val"); // generate the list of payment types to be displayed and add it to the view bag ViewBag.paymentTypeList = new SelectList(helper.GetPaymentTypes(false), "id", "val"); //generate the list of academic years to be displayed and add it to the view bag ViewBag.academicYearList = new SelectList(helper.GetValidAcademicYears(viewModel.year), DateTime.Now.Year + ""); return(View(viewModel)); }
/// <summary> /// Action Method to perform hostel transaction /// </summary> /// <param name="userInput">the form filled by the user</param> /// <returns></returns> public ActionResult PerformHostelTransaction(HostelTransactionViewModel userInput) { TransactionHelper helper = new TransactionHelper(); // if model is not valid do not process furthur if (!ModelState.IsValid) { // generate the list of account heads to be displayed and add it to the view bag ViewBag.acHeadList = new SelectList(helper.GetAccountHeads(), "id", "val"); // generate the list of payment types to be displayed and add it to the view bag ViewBag.paymentTypeList = new SelectList(helper.GetPaymentTypes(false), "id", "val"); return(PartialView("_AddHostelTransation", userInput)); } // add the transaction to the database return(Content(helper.PerformHostelTransaction(userInput))); }
public ActionResult DiscountFees(StudentSearchViewModel userInput) { TransactionHelper helper = new TransactionHelper(); string error = ""; HostelTransactionViewModel viewModel = helper.ConstructViewModelForHostelFeeDiscount(userInput.bid, out error); if (viewModel != null) { // generate the list of account heads to be displayed and add it to the view bag ViewBag.acHeadList = new SelectList(helper.GetAccountHeads(), "id", "val"); // generate the list of payment types to be displayed and add it to the view bag ViewBag.paymentTypeList = new SelectList(helper.GetPaymentTypes(true), "id", "val", "4"); //generate the list of academic years to be displayed and add it to the view bag ViewBag.academicYearList = new SelectList(helper.GetValidAcademicYears(viewModel.year), DateTime.Now.Year + ""); // display the view return(PartialView("_AddDiscount", viewModel)); } return(Content(error)); }
public ActionResult PerformHostelFeeDiscount(HostelTransactionViewModel userInput) { TransactionHelper helper = new TransactionHelper(); return(Content(helper.PerformFeeDiscount(userInput))); }