public async Task <IActionResult> Create([FromBody] RotaUrlModel model) { if (model == null) { return(BadRequest("Informações da rota URL não preenchidas.")); } if (string.IsNullOrEmpty(model.Nome)) { return(BadRequest("Nome da rota URL não informada, obrigatório.")); } var entity = ConvertModels.ConverterToEntity(model); entity.Chave = ObterNovaChaveRota(); await RotaUrlRepository.Create(entity); return(Ok($"Rota URL [chave: {entity.Chave}] registrada com sucesso.")); }
public async Task <IActionResult> Create([FromBody] AcessoRotaUrlModel model) { if (model == null) { return(BadRequest("Informações de Acesso a Rota Url não preenchidas.")); } if (string.IsNullOrEmpty(model.ChaveRota)) { return(BadRequest("Chave da rota url não informada, obrigatório.")); } if (model.DataHoraAcesso == null) { model.DataHoraAcesso = DateTime.Now; } var entity = ConvertModels.ConverterToEntity(model); await AcessoRotaUrlRepository.Create(entity); return(Ok($"Acesso a rota Url [{entity.Id}] registrado com sucesso.")); }