Exemplo n.º 1
0
        public IActionResult AddProgram(ProgramViewModel model)
        {
            /*double cost;
             * string type = model.cost_type.ToString();*/

            if (ModelState.IsValid)
            {
                //check the cost_type to verify the cost of the program
                //paid option = 300K

                //Income_Sharing = 1M
                //switch (model.cost_type)
                //{
                //    case Models.Students.addmissionType.Paid:
                //        cost = 300000;
                //        break;
                //    case Models.Students.addmissionType.Income_Sharing:
                //        cost = 1000000;
                //        break;
                //    default:
                //        break;
                //}

                Programme programme = new Programme()
                {
                    Program_Name = model.ProgramName,
                    Cost         = model.cost,
                    Duration     = model.duration
                };
                _programRepo.AddProgramme(programme);
                return(RedirectToAction("Index"));
            }
            return(View());
        }