Beispiel #1
0
        public async Task Update(params UpdateAchievementModel[] requests)
        {
            foreach (var request in requests)
            {
                var achievementInDb = await _achievementRepository.GetByIdWithTracking(request.Id);

                if (achievementInDb == null)
                {
                    throw new NotFoundException("Achievement not found.");
                }

                await AcademicYearModel.CheckLock(_academicYearRepository, achievementInDb.AcademicYearId);

                achievementInDb.AchievementTypeId = request.AchievementTypeId;
                achievementInDb.LocationId        = request.LocationId;
                achievementInDb.OutcomeId         = request.OutcomeId;
                achievementInDb.Comments          = request.Comments;
                achievementInDb.Points            = request.Points;
            }

            await _achievementRepository.SaveChanges();
        }