Esempio n. 1
0
        public int UpdateGameSession(GameSession gameSession)
        {
            if (gameSession == null)
            {
                return(0);
            }

            using (var _db = new ApplicationDbContext())
            {
                var response = _GSessionService.UpdateGameSession(_db, gameSession);
                try
                {
                    return(_db.SaveChanges());
                }
                catch (DbEntityValidationException)
                {
                    _db.Entry(response).CurrentValues.SetValues(_db.Entry(response).OriginalValues);
                    _db.Entry(response).State = System.Data.Entity.EntityState.Unchanged;
                    return(0);
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(0);
                }
            }
        }