public PartInformation Read(int id) { using (var db = new LifestyleCheckerContext()) { return(db.PartInformations.Include(journal => journal.Journal).FirstOrDefault(schoolEvent => schoolEvent.Id == id)); } }
public Journal Read(int id) { using (var db = new LifestyleCheckerContext()) { return(db.Journals.Include(journal => journal.PartInformations).FirstOrDefault(journal => journal.Id == id)); } }
public bool Delete(PartInformation item) { using (var db = new LifestyleCheckerContext()) { db.Entry(item).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); return(Read(item.Id) == null); } }
public PartInformation Update(PartInformation item) { using (var db = new LifestyleCheckerContext()) { db.Entry(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(item); } }
public Journal Update(Journal item) { using (var db = new LifestyleCheckerContext()) { db.Entry(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(item); } }
public List <Journal> ReadAll() { using (var db = new LifestyleCheckerContext()) { if (db.Journals != null) { return(db.Journals.Include(journal => journal.PartInformations).ToList()); } return(new List <Journal>()); } }
public List <PartInformation> ReadAll() { using (var db = new LifestyleCheckerContext()) { if (db.PartInformations != null) { return(db.PartInformations.Include(partInformation => partInformation.Journal).ToList()); } return(new List <PartInformation>()); } }
public PartInformation Create(PartInformation item) { using (var db = new LifestyleCheckerContext()) { if (db.PartInformations == null) { return(null); } item.Journal = db.Journals.Include(journal => journal.PartInformations).FirstOrDefault(journal => journal.Id == item.Journal.Id); db.PartInformations.Add(item); db.SaveChanges(); return(item); } }
public Journal Create(Journal item) { using (var db = new LifestyleCheckerContext()) { if (db.Journals == null) { return(null); } foreach (var partInformation in item.PartInformations) { db.Entry(partInformation).State = EntityState.Unchanged; } db.Journals.Add(item); db.SaveChanges(); return(item); } }