예제 #1
0
 public async Task <IActionResult> Create([Bind("ID,Name,GradeId,GradeTitle")] Major major)
 {
     if (ModelState.IsValid)
     {
         major.GradeTitle = _gradeRepository.GetGradeById(major.GradeId.Value).Name;
         _majorRepository.InsertMajor(major);
         _majorRepository.Save();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(major));
 }