Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public TarjetaEntity Update(int id, TarjetaRequest.Update entity)
 {
     throw new NotImplementedException();
 }