Exemple #1
0
        public ActionResult <TalkDto> GetById(int id)
        {
            var talks = service.getTalkById(id);

            if (talks != null)
            {
                return(Ok(mapper.Map <TalkDto>(talks)));
            }
            return(NotFound($"Talk with ID: {id} was not found"));
        }
        public IActionResult Edit(int?id)
        {
            TalkDto model = new TalkDto();

            if (id.HasValue)
            {
                var existingTalk = service.getTalkById(id.Value);
                if (existingTalk != null)
                {
                    model = mapper.Map <TalkDto>(existingTalk);
                }
            }

            return(View(model));
        }