public async Task <ActionResult> Put(int id, [FromBody] EmailClienteCreacionDTo emailActualizar) { var email = mapper.Map <EmailCliente>(emailActualizar); email.codigoEmail = id; contexto.Entry(email).State = EntityState.Modified; await contexto.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult> Post([FromBody] EmailClienteCreacionDTo emailCreacion) { var email = mapper.Map <EmailCliente>(emailCreacion); contexto.Add(email); await contexto.SaveChangesAsync(); var emailDTO = mapper.Map <EmailClienteDTO>(email); return(new CreatedAtRouteResult("GetEmailCliente", new { id = email.codigoEmail }, emailDTO)); }