public async Task <CustomTemplateResponse> UpdateTemplate( CreateCustomTemplateRequest createCustomTemplateRequest) { var request = MapTemplateRequest(createCustomTemplateRequest); var response = await _customTemplateRepository.UpdateAsync(request, request.Id); return(MapTemplateResponse(response)); }
private Domain.CustomEntity.CustomEntity MapTemplateRequest(CreateCustomTemplateRequest templateRequest) { return(new Domain.CustomEntity.CustomEntity { Id = templateRequest.Id, TemplateName = templateRequest.TemplateName, AddedBy = 1, ModifiedBy = templateRequest.Id == default(int) ? (int?)null : 1, ModifiedDate = templateRequest.Id == default(int) ? (DateTime?)null : DateTime.UtcNow, EntityGroupId = templateRequest.CategoryId == default(int) ? null : templateRequest.CategoryId, IsArchived = false, IsDeleted = false, }); }
public async Task <CustomDto> AddCustomTemplate(CreateCustomTemplateRequest createCustomTemplateRequest) { var template = new Domain.CustomEntity.CustomEntity { Id = createCustomTemplateRequest.Id, TemplateName = createCustomTemplateRequest.TemplateName, EntityGroupId = createCustomTemplateRequest.CategoryId, IsArchived = false, IsDeleted = false, AddedBy = 1, AddedDate = DateTime.UtcNow }; var response = await _customTemplateRepository.AddAsync(template); return(response.Id != default(int) ? new CustomDto { Id = response.Id, Caption = response.TemplateName } : null); }
public async Task <IActionResult> Put([FromBody] CreateCustomTemplateRequest createCustomTemplateRequest) { var response = await _customTemplateService.UpdateTemplate(createCustomTemplateRequest); return(Ok(response)); }