Esempio n. 1
0
        public async Task <ActionResult> Put(int id, [FromBody] TelefonoClientesCreacionDTO telefonoClienteActualizar)
        {
            var telefonoClientes = mapper.Map <TelefonoCliente>(telefonoClienteActualizar);

            telefonoClientes.CodigoTelefono        = id;
            contexto.Entry(telefonoClientes).State = EntityState.Modified;
            await contexto.SaveChangesAsync();

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult> Post([FromBody] TelefonoClientesCreacionDTO telefonoClientesCreacion)
        {
            var telefonoClientes = mapper.Map <TelefonoCliente>(telefonoClientesCreacion);

            contexto.Add(telefonoClientes);
            await contexto.SaveChangesAsync();

            var telefonoLCientesDTO = mapper.Map <TelefonoClienteDTO>(telefonoClientes);

            return(new CreatedAtRouteResult("GetTelefonoCLientes", new { id = telefonoClientes.CodigoTelefono }, telefonoLCientesDTO));
        }