public async Task <ActionResult> Put(int id, [FromBody] TelefonoClienteCreacionDTO telefonOActualizar) { var telefono = mapper.Map <TelefonoCliente>(telefonOActualizar); telefono.codigoTelefono = id; contexto.Entry(telefono).State = EntityState.Modified; await contexto.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult> Put(int id, [FromBody] TelefonoClienteCreacionDTO telefonoClienteActualizacion) { var telefonoCliente = this.mapper.Map <TelefonoCliente>(telefonoClienteActualizacion); telefonoCliente.CodigoTelefono = id; this.dBContext.Entry(telefonoCliente).State = EntityState.Modified; await this.dBContext.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult> Post([FromBody] TelefonoClienteCreacionDTO telefonoCreacion) { var telefono = mapper.Map <TelefonoCliente>(telefonoCreacion); contexto.Add(telefono); await contexto.SaveChangesAsync(); var telefonoDTO = mapper.Map <TelefonoClienteDTO>(telefono); return(new CreatedAtRouteResult("GetTelefonoCliente", new { id = telefono.codigoTelefono }, telefonoDTO)); }
public async Task <ActionResult> Post([FromBody] TelefonoClienteCreacionDTO telefonoClienteCreacion)//Se espera recibir un JSON o un DOC.XML { var telefonoCliente = this.mapper.Map <TelefonoCliente>(telefonoClienteCreacion); this.dBContext.Add(telefonoCliente); await this.dBContext.SaveChangesAsync(); var telefonoClienteDTO = this.mapper.Map <TelefonoClienteDTO>(telefonoCliente); return(new CreatedAtRouteResult("GetTelefonoCliente", new { id = telefonoCliente.CodigoTelefono }, telefonoClienteDTO)); }
public async Task <ActionResult> Post([FromBody] TelefonoClienteCreacionDTO telefonoClienteCreacion) { var telefonoCliente = _mapper.Map <TelefonoCliente>(telefonoClienteCreacion); _contexto.Add((object)telefonoCliente); await _contexto.SaveChangesAsync(); var telefonoClienteDto = _mapper.Map <TelefonoClienteDTO>(telefonoCliente); return(new CreatedAtRouteResult("GetTelefonoCliente", new { id = telefonoCliente.CodigoTelefono }, telefonoClienteDto)); }
public async Task <ActionResult> Post([FromBody] TelefonoClienteCreacionDTO telefonoClienteCreacionDTO) { var telefonoCliente = this.mapper.Map <TelefonoCliente>(telefonoClienteCreacionDTO); this.inventarioDBContext.Add(telefonoCliente); await this.inventarioDBContext.SaveChangesAsync(); var telefonoClienteDTO = this.mapper.Map <TelefonoClienteDTO>(telefonoCliente); return(new CreatedAtRouteResult("GetTelefonoCliente", new { id = telefonoCliente.CodigoTelefono }, telefonoClienteDTO)); }