public async Task <IActionResult> GetById(int messageId)
 {
     try
     {
         return(Ok(await _messagesService.GetByIdAsync(messageId)));
     }
     catch (NotFoundCustomException exception)
     {
         return(NotFound(exception.Message));
     }
 }
Example #2
0
        public async Task <ActionResult> Edit(int id)
        {
            var message = await _messagesService.GetByIdAsync(id);

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

            var model = message.MapViewModel(_mapper);

            if (!(message.Returned))
            {
                if (String.IsNullOrEmpty(model.ReturnContentView.Template))
                {
                    model.ReturnContentView.Template = GetMailTemplate(_environment, _appSettings);
                }
            }

            return(Ok(model));
        }