Esempio n. 1
0
 public void Delete(T entity)
 {
     try
     {
         dBContext.Entry <T>(entity).State = EntityState.Deleted;
     }
     catch (Exception ee)
     {
     }
 }
Esempio n. 2
0
 public void Delete(T entity)
 {
     try
     {
         dBContext.Entry <T>(entity).State = Microsoft.EntityFrameworkCore.EntityState.Deleted;
     }
     catch (Exception ee)
     {
     }
 }
Esempio n. 3
0
 public void Delete(T entity)
 {
     try
     {
         //if (dbContext.Entry<T>(entity).State == EntityState.Detached) {
         //    dbContext.Set<T>().Add(entity);
         //}
         dbContext.Entry <T>(entity).State = EntityState.Deleted;
     }
     catch (Exception)
     {
     }
 }
        public async Task <IActionResult> PutSolicitude(int id, Solicitudes Solicitude)
        {
            if (id != Solicitude.SolicitudId)
            {
                return(BadRequest());
            }

            _context.Entry(Solicitude).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SolicitudeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 5
0
        public async Task <IActionResult> PutEquipoXDepartamento(int id, Equipo_X_Departamento EquipoXDepartamento)
        {
            if (id != EquipoXDepartamento.DepartamentoId)
            {
                return(BadRequest());
            }

            _context.Entry(EquipoXDepartamento).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EquipoXDepartamentoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutDepartamentoXCliente(int id, Departamento_X_Cliente DepartamentoXCliente)
        {
            if (id != DepartamentoXCliente.DepartamentoId)
            {
                return(BadRequest());
            }

            _context.Entry(DepartamentoXCliente).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DepartamentoXClienteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 7
0
        public async Task <IActionResult> PutTipoTrabajo(int id, TipoTrabajo TipoTrabajo)
        {
            if (id != TipoTrabajo.TipoTrabajoId)
            {
                return(BadRequest());
            }

            _context.Entry(TipoTrabajo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TipoTrabajoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutProvincia(int id, Provincias Provincia)
        {
            if (id != Provincia.ProvinciaId)
            {
                return(BadRequest());
            }

            _context.Entry(Provincia).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProvinciaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 9
0
        public async Task <IActionResult> PutTransformers(int id, Transformers transformers)
        {
            if (id != transformers.Id)
            {
                return(BadRequest());
            }

            _context.Entry(transformers).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TransformersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 10
0
        public async Task <IActionResult> PutUsuario(string id, Usuarios Usuario)
        {
            if (id != Usuario.Usuario)
            {
                return(BadRequest());
            }

            _context.Entry(Usuario).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (Usuario == null)
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 11
0
        public async Task <IActionResult> PutEmpleado(String id, Empleados Empleado)
        {
            if (id != Empleado.EmpleadoCedula)
            {
                return(BadRequest());
            }

            _context.Entry(Empleado).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (Empleado == null)
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }