Example #1
0
        public async Task <bool> PostLessonInformation(int lessonId, DateTime date, LessonInforamtionDto informationDto)
        {
            LessonInHistory lessonInHistory = await GetOrCreateLessonInHistory(lessonId, date);

            var inforamtionToCreate = _mapper.Map <LessonInformation>(informationDto);

            inforamtionToCreate.LessonInHistoryId = lessonInHistory.LessonInHistoryId;

            _uow.LessonInformationRepository.Add(inforamtionToCreate);
            return(await _uow.SaveChanges());
        }
Example #2
0
        public async Task <IActionResult> PostLessonInforamtion(int lessonId, DateTime date, [FromBody] LessonInforamtionDto inforamtion)
        {
            var result = await _lessonService.PostLessonInformation(lessonId, date, inforamtion);

            if (result)
            {
                return(StatusCode(201));
            }
            return(BadRequest("Fail to create lesson information"));
        }