public void Update(User obj) { using (var db = new CalcContext()) { db.Entry(obj).State = EntityState.Modified; db.SaveChanges(); } }
public User GetByName(string login) { using (var db = new CalcContext()) { var user = db.Users.FirstOrDefault(u => u.Login == login); db.Entry(user).Collection(u => u.OperResults).Load(); return(user); } }
public Operation Read(long Id) { using (var db = new CalcContext()) { var operation = db.Operations.FirstOrDefault(u => u.Id == Id); db.Entry(operation).Collection(u => u.OperResults).Load(); return(operation); } }