Ejemplo n.º 1
0
        public IActionResult Post([FromBody] Clientes model)
        {
            return(Ok(

                       _ClientesService.Add(model)

                       ));
        }
 public void AddCliente([FromBody] Cliente value)
 {
     try
     {
         clientesOps.Add(value);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public IHttpActionResult Post(ClientesDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ClientesDto clienteDtoInsert = null;

            try
            {
                clienteDtoInsert = clientesService.Add(model);
            }
            catch (VuelingException ex)
            {
                VuelingLogger.Logger(ex);
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            return(CreatedAtRoute("DefaultApi",
                                  new { id = clienteDtoInsert.id }, clienteDtoInsert));
        }