public ContentResult Register(UsuarioRequest req) { ContentResult response = new ContentResult { ContentType = "application/json" }; try { var checkIfExists = _service.FindByLogin(req.Login); if (checkIfExists != null) { response.StatusCode = (int)HttpStatusCode.BadRequest; response.Content = JsonConvert.SerializeObject("Usuario já existe"); return(response); } var result = _service.Create(req); _uof.Commit(); response.StatusCode = (int)HttpStatusCode.OK; response.Content = JsonConvert.SerializeObject(result); return(response); } catch (Exception ex) { response.StatusCode = (int)HttpStatusCode.BadRequest; response.Content = ex.Message; return(response); } }