public async Task <IActionResult> Edit(int id)
        {
            var emailTemplate = await _emailTemplateRepository.GetEmailTemplateById(id);

            if (emailTemplate == null)
            {
                return(RedirectToAction("List"));
            }

            var model = _mapper.Map <EmailTemplate, EmailTemplateViewModel>(emailTemplate);

            return(View(model));
        }
Beispiel #2
0
        public async Task <ActionResult> GetById(int id)
        {
            try
            {
                var result = await _repository.GetEmailTemplateById(id);

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

                return(Ok(result));
            }
            catch (Exception ex)
            {
                throw new JsonException(ex.Message, ex);
            }
        }
Beispiel #3
0
 public EmailTemplate GetEmailTemplateById(int id)
 {
     return(_repository.GetEmailTemplateById(id));
 }