Beispiel #1
0
        public IActionResult Update(int id, [FromBody] TalkUpdateDto talkUpdateDto)
        {
            if (talkUpdateDto == null)
            {
                return(BadRequest());
            }

            Talk existingTalk = _talksRepository.GetSingle(id, User.Identity.Name);

            if (existingTalk == null)
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            AutoMapper.Mapper.Map(talkUpdateDto, existingTalk);

            _talksRepository.Update(existingTalk);

            if (!_talksRepository.Save())
            {
                throw new Exception("Updating a fooditem failed on save.");
            }

            return(Ok(AutoMapper.Mapper.Map <TalkDto>(existingTalk)));
        }
Beispiel #2
0
 public Talks UpdateTalk(Talks talkToUpdate)
 {
     return(talksRepository.Update(talkToUpdate));
 }
        public Talks Update(Talks talks)
        {
            var update = talkRepository.Update(talks);

            return(update);
        }