Exemplo n.º 1
0
        public ActionResult BatchAdd(BatchAddVM Model)
        {
            var students = new List <Student>();

            if (ModelState.IsValid)
            {
                Model.DistrictID = 1;

                int DistrictId = Model.DistrictID;

                foreach (var student in Model.Students)
                {
                    student.DistrictID = DistrictId;
                    students.Add(student);
                }
            }

            _studentManager.Add(students);

            Model.DistrictList = _districtManager.GetAll()
                                 .Select(c => new SelectListItem()
            {
                Value = c.ID.ToString(),
                Text  = c.Name
            }).ToList();

            return(View(Model));
        }
Exemplo n.º 2
0
        public ActionResult BatchAdd()
        {
            BatchAddVM batchAddVM = new BatchAddVM();

            batchAddVM.DistrictList = _districtManager.GetAll()
                                      .Select(c => new SelectListItem()
            {
                Value = c.ID.ToString(),
                Text  = c.Name
            }).ToList();

            return(View(batchAddVM));
        }