예제 #1
0
 public void Update(User obj)
 {
     using (var db = new CalcContext())
     {
         db.Entry(obj).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
            }
        }