Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateMeeting(int id, MeetingCreateDto meetingCreateDto)
        {
            var meetingFromRepo = await _repo.GetMeeting(id);

            _mapper.Map(meetingCreateDto, meetingFromRepo);
            if (await _repo.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception($"Updating meeting {meetingCreateDto.Title} failed on server");
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddMeeting(MeetingCreateDto meetingCreateDto)
        {
            Meeting meetingToCreate = _mapper.Map <Meeting>(meetingCreateDto);

            _repo.Add(meetingToCreate);
            if (await _repo.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception($"Creating meeting failed on save");
        }