public int Update(int id, string codigoNomina, string nombre, string entidad, bool activo, DateTime fechaInicio, DateTime fechaTermino, string cargo) { try { using (var Conexion = new EntitiesMKT()) { Gerente gerente = Conexion.Gerente.Where(x => x.Id == id).FirstOrDefault(); gerente.CodigoNomina = codigoNomina; gerente.Nombre = nombre; gerente.Cargo = cargo; gerente.Entidad = entidad; gerente.Activo = activo; gerente.FechaInicio = fechaInicio; gerente.FechaTermino = fechaTermino; Conexion.Entry(gerente).State = EntityState.Modified; return(Conexion.SaveChanges()); } } catch (Exception) { return(0); } }
public int Delete(int id) { try { using (var Conexion = new EntitiesMKT()) { Gerente gerente = Conexion.Gerente.Where(x => x.Id == id).FirstOrDefault(); Conexion.Entry(gerente).State = EntityState.Deleted; return(Conexion.SaveChanges()); } } catch (Exception er) { return(0); } }
public int Update(DateTime fechaEntrega, DateTime fechaSolicitud, int idSIM, int idGerente, int idSIMGerente) { try { using (var Conexion = new EntitiesMKT()) { SIMS_GERENTE sIMS_GERENTE = Conexion.SIMS_GERENTE.Where(x => x.ID_SIM_GERENTE == idSIMGerente).FirstOrDefault(); sIMS_GERENTE.FECHA_ENTREGA = fechaEntrega; sIMS_GERENTE.FECHA_SOLICITUD = fechaSolicitud; sIMS_GERENTE.ID_SIM = idSIM; sIMS_GERENTE.ID_GERENTE = idGerente; Conexion.Entry(sIMS_GERENTE).State = EntityState.Modified; return(Conexion.SaveChanges()); } } catch (Exception) { return(0); } }