public ActionResult EditMessTransaction(MessTransactionViewModel userInput)
        {
            if (!ModelState.IsValid)
            {
                return(View(userInput));
            }

            TransactionHelper helper = new TransactionHelper();

            helper.EditMessTransaction(userInput);
            TempData["bid"] = userInput.bid;

            return(RedirectToAction("MessTransaction"));
        }
        public ActionResult EditMessTransaction(int id)
        {
            TransactionHelper        helper    = new TransactionHelper();
            MessTransactionViewModel viewModel = helper.GetMessTransactionViewModel(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));

            return(View(viewModel));
        }
        public ActionResult MessTransaction(StudentSearchViewModel userInput)
        {
            string                   error     = "";
            TransactionHelper        helper    = new TransactionHelper();
            MessTransactionViewModel viewModel = helper.ConstructViewModelForMessTransaction(userInput.bid, out error);

            if (viewModel != null)
            {
                // 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(PartialView("_AddMessTransaction", viewModel));
            }
            else
            {
                return(Content(error));
            }
        }
        /// <summary>
        /// Action method to perform the mess transaction
        /// </summary>
        /// <param name="userInput">the form filled by the user</param>
        /// <returns>Content</returns>
        public ActionResult PerformMessTransaction(MessTransactionViewModel userInput)
        {
            TransactionHelper helper = new TransactionHelper();

            return(Content(helper.PerformMessTransaction(userInput)));
        }