public static Utilizator Insert(Utilizator entity) { using (var context = new CatalogProjectEntities()) { entity = context.Utilizators.Add(entity); context.SaveChanges(); } return(entity); }
public static Functie Insert(Functie entity) { using (var context = new CatalogProjectEntities()) { entity = context.Functies.Add(entity); context.SaveChanges(); } return(entity); }
public static Elev Insert(Elev entity) { using (var context = new CatalogProjectEntities()) { entity = context.Elevs.Add(entity); context.SaveChanges(); } return(entity); }
public static Clasa Insert(Clasa entity) { using (var context = new CatalogProjectEntities()) { entity = context.Clasas.Add(entity); context.SaveChanges(); } return(entity); }
public static Clasa Get(int id) { Clasa retValue; using (var context = new CatalogProjectEntities()) { retValue = context.Clasas.FirstOrDefault(x => x.ID == id); } return(retValue); }
public static IEnumerable <MaterieClasa> GetAll() { IEnumerable <MaterieClasa> retValue; using (var context = new CatalogProjectEntities()) { retValue = context.MaterieClasas.ToList(); } return(retValue); }
public static IEnumerable <UtilizatorAsteptare> GetAll() { IEnumerable <UtilizatorAsteptare> retValue; using (var context = new CatalogProjectEntities()) { retValue = context.UtilizatorAsteptares; } return(retValue); }
public static Utilizator GetByUsername(string username) { Utilizator retValue; using (var context = new CatalogProjectEntities()) { retValue = context.Utilizators.FirstOrDefault(x => x.Username == username); } return(retValue); }
public static IEnumerable <Elev> GetAll() { IEnumerable <Elev> retValue; using (var context = new CatalogProjectEntities()) { retValue = context.Elevs.ToList(); } return(retValue); }
public static Functie Get(int id) { Functie retValue; using (var context = new CatalogProjectEntities()) { retValue = context.Functies.FirstOrDefault(x => x.ID == id); } return(retValue); }
public static Elev Get(int id) { Elev retValue; using (var context = new CatalogProjectEntities()) { retValue = context.Elevs.FirstOrDefault(x => x.ID == id); } return(retValue); }
public static Utilizator Get(int id) { Utilizator retValue; using (var context = new CatalogProjectEntities()) { retValue = context.Utilizators.FirstOrDefault(x => x.ID == id); } return(retValue); }
public static void Delete(int id) { using (var context = new CatalogProjectEntities()) { var entity = context.Elevs.FirstOrDefault(x => x.ID == id); if (entity != null) { context.Elevs.Remove(entity); context.SaveChanges(); } } }
public static void Update(Materie materie) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.Materies.FirstOrDefault(x => x.ID == materie.ID); if (dbEntity == null) { dbEntity = new Materie(); context.Materies.Add(dbEntity); } dbEntity.Nume = materie.Nume; context.SaveChanges(); } }
public static void Update(Functie functie) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.Functies.FirstOrDefault(x => x.ID == functie.ID); if (dbEntity == null) { dbEntity = new Functie(); context.Functies.Add(dbEntity); } dbEntity.Descriere = functie.Descriere; context.SaveChanges(); } }
public static void Update(Elev elev) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.Elevs.FirstOrDefault(x => x.ID == elev.ID); if (dbEntity == null) { dbEntity = new Elev(); context.Elevs.Add(dbEntity); } dbEntity.IDUtilizator = elev.IDUtilizator; dbEntity.IDClasa = elev.IDClasa; context.SaveChanges(); } }
public static void Update(UtilizatorAsteptare utilizatorAsteptare) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.UtilizatorAsteptares.FirstOrDefault(x => x.ID == utilizatorAsteptare.ID); if (dbEntity == null) { dbEntity = new UtilizatorAsteptare(); context.UtilizatorAsteptares.Add(dbEntity); } dbEntity.IDUtilizator = utilizatorAsteptare.IDUtilizator; dbEntity.Hash = utilizatorAsteptare.Hash; context.SaveChanges(); } }
public static void Update(Clasa clasa) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.Clasas.FirstOrDefault(x => x.ID == clasa.ID); if (dbEntity == null) { dbEntity = new Clasa(); context.Clasas.Add(dbEntity); } dbEntity.Nume = clasa.Nume; dbEntity.IDDiriginte = clasa.IDDiriginte; context.SaveChanges(); } }
public static void Update(Profesor profesor) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.Profesors.FirstOrDefault(x => x.ID == profesor.ID); if (dbEntity == null) { dbEntity = new Profesor(); context.Profesors.Add(dbEntity); } dbEntity.IDUtilizator = profesor.IDUtilizator; dbEntity.Detalii = profesor.Detalii; dbEntity.IDMaterie = profesor.IDMaterie; context.SaveChanges(); } }
public static void Update(Absenta absenta) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.Absentas.FirstOrDefault(x => x.ID == absenta.ID); if (dbEntity == null) { dbEntity = new Absenta(); context.Absentas.Add(dbEntity); } dbEntity.IDElev = absenta.IDElev; dbEntity.IDMaterieClasa = absenta.IDMaterieClasa; dbEntity.DataAbsenta = absenta.DataAbsenta; context.SaveChanges(); } }
public static void Update(MaterieClasa materieClasa) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.MaterieClasas.FirstOrDefault(x => x.ID == materieClasa.ID); if (dbEntity == null) { dbEntity = new MaterieClasa(); context.MaterieClasas.Add(dbEntity); } dbEntity.IDClasa = materieClasa.IDClasa; dbEntity.IDMaterie = materieClasa.IDMaterie; dbEntity.OreSaptamanal = materieClasa.OreSaptamanal; dbEntity.IDProfesor = materieClasa.IDProfesor; context.SaveChanges(); } }
public static void Update(Utilizator utilizator) { using (var context = new CatalogProjectEntities()) { var dbEntity = context.Utilizators.FirstOrDefault(x => x.ID == utilizator.ID); if (dbEntity == null) { dbEntity = new Utilizator(); context.Utilizators.Add(dbEntity); } dbEntity.Username = utilizator.Username; dbEntity.Parola = utilizator.Parola; dbEntity.IDFunctie = utilizator.IDFunctie; dbEntity.Email = utilizator.Email; dbEntity.Prenume = utilizator.Prenume; dbEntity.Nume = utilizator.Nume; dbEntity.ContActiv = utilizator.ContActiv; dbEntity.IDElev = utilizator.IDElev; context.SaveChanges(); } }