Beispiel #1
0
        public ActionResult ChangeFees(string gender, string roomType1)
        {
            StudentHelper     helper  = new StudentHelper();
            TransactionHelper tHelper = new TransactionHelper();

            // populate the room type list such that the appropriate option is selected
            try
            {
                int roomTypeID = helper.GetRoomTypes().Where(y => y.val.Equals(roomType1)).First().id;
                ViewBag.roomTypeList = new SelectList(db.RoomTypes.ToList(), "id", "val", roomTypeID);
            }
            catch (InvalidOperationException)
            {
                ViewBag.roomTypeList = new SelectList(db.RoomTypes, "id", "val");
            }

            // populate the gender list such that the appropriate option is selected
            try
            {
                int genId = helper.GetGenders().Where(x => x.val.Equals(gender)).First().id;
                ViewBag.hostelTypeList = new SelectList(db.Genders.ToList(), "id", "val", genId);
            }
            catch (InvalidOperationException)
            {
                ViewBag.hostelTypeList = new SelectList(db.Genders, "id", "val");
            }

            // add the mess charges to the model
            ViewBag.messChargesModel  = tHelper.ConstructViewModelForMessFeeChange();
            TempData["canChangeMess"] = tHelper.CanChangeMessFees();

            return(View());
        }