public static Type ToEntity(this TypeCreationDto dto) { return(new Type { Description = dto.Description, Code = dto.Code }); }
public IActionResult Add([FromBody] TypeCreationDto request) { try { _service.Add(request.ToEntity()); return(Ok()); } catch (Exception e) { _logger.LogError(-1, e, String.Format(LogErrorText, e.Message)); return(BadRequest(String.Format(BadRequestText, "adding type"))); } }