예제 #1
0
        public void UpdateHomework(HomeworkDTO hw)
        {
            var homew = _homeworkRepo.Get(c => c.HomeworkId == hw.HomeworkId);
            if (homew == null)
                throw new Exception("Homework not found.");

            homew.Text = hw.Text;
            homew.Score = hw.Score;
            
            _homeworkRepo.SaveChanges();
        }
예제 #2
0
 public void CreateHomework(HomeworkDTO dtoHw)
 {
     var h = Mapper.Map<Homework>(dtoHw);
     h.Module = _moduleRepo.Get(u => u.ModuleId == dtoHw.Module.ModuleId);
     _homeworkRepo.Add(h);
 }