public IActionResult Post(ClienteModel cliente)
        {
            var result = _business.Add(cliente);

            if (result.Success)
            {
                return(Ok(result.Resource));
            }

            return(BadRequest(result.Message));
        }
 public HttpResponseMessage Add(ClienteViewModel clienteViewModel)
 {
     try
     {
         return(Request.CreateResponse(HttpStatusCode.OK, m_ClienteBusiness.Add(clienteViewModel)));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                            string.Format("Error:{0}!", ex.Message)));
     }
 }
        public IActionResult Post(ClienteModel newModel)
        {
            try
            {
                if (newModel != null && newModel.IsValid())
                {
                    newModel.Cadastro = DateTime.Now;
                    newModel.Ativo    = true;
                    _clienteBusiness.Add(newModel.ToDomain());
                    return(Ok(newModel.ToBody()));
                }

                return(BadRequest("Preencha corretamente todos os campos do cliente."));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }