コード例 #1
0
        public void Handle(StudyCreatedEvent e)
        {
            var study = new Study();

            study.Apply(e);

            _studyRepository.Save(study);
        }
コード例 #2
0
ファイル: StudysController.cs プロジェクト: khorshidis68/cms
 public async Task <IActionResult> Create([Bind("ID,Code,Name,TheoreticalHour,PracticalHour,TheoreticalCount,PracticalCount,LessonType,LessonTypeCode,GradeId")] StudyViewModel study)
 {
     if (ModelState.IsValid)
     {
         Study newRecore = new Study()
         {
             ID               = study.ID,
             Code             = study.Code,
             GradeId          = study.GradeId,
             LessonType       = study.LessonType,
             LessonTypeCode   = study.LessonTypeCode,
             Name             = study.Name,
             PracticalCount   = study.PracticalCount,
             PracticalHour    = study.PracticalHour,
             TheoreticalCount = study.TheoreticalCount,
             TheoreticalHour  = study.TheoreticalHour
         };
         _studyRepository.InsertStudy(newRecore);
         _studyRepository.Save();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(study));
 }