public async Task<TemplateGetResponse> GetTemplateById(TemplateGetRequest request) { var response = new TemplateGetResponse(); try { if (string.IsNullOrEmpty(request.Id)) { response.Template = new TemplateViewModel() { Status = EnumDefine.CommonStatusEnum.New }; } else { var data = await _templateService.GetById(request.Id); response.Template = data.ToModel(); } response.SetSucess(); } catch (Exception e) { response.SetFail(e); _logger.LogError(e, e.Message, request); } return response; }
public async Task <IActionResult> Get([FromBody] TemplateGetRequest request) { try { var response = await _templateAppService.GetTemplateById(request); return(Json(response)); } catch (Exception e) { _logger.LogError(e, Common.Common.GetMethodName(), request); throw; } }