public TarjetaEntity Update(int id, TarjetaRequest.Update tarjeta) { TarjetaEntity tarjetaEntity = _tarjetaRepo.Find(id); if (tarjetaEntity == null) { throw new Exception("El id de la tarjeta no existe"); } tarjetaEntity.Pin = tarjeta.Pin; EntityEntry <TarjetaEntity> modTarjeta = _tarjetaRepo.Update(tarjetaEntity); _context.SaveChanges(); return(modTarjeta.Entity); }
public ActionResult <TarjetaResponse> Put(int id, [FromBody] TarjetaRequest.Update tarjeta) { if (ModelState.IsValid == false) { return(BadRequest(ModelState)); } IResponse <TarjetaEntity> respuesta = new TarjetaResponse(); try { TarjetaEntity nuevaTarjeta = _tarjetaService.Update(id, tarjeta); respuesta.Resultado = "S"; respuesta.Datos.Add(nuevaTarjeta); } catch (Exception ex) { respuesta.Resultado = "E"; respuesta.Mensaje = ex.Message.ToString(); } return(Ok(respuesta)); }
public TarjetaEntity Update(int id, TarjetaRequest.Update entity) { throw new NotImplementedException(); }