Пример #1
0
 public DbError UpdateGameType(GameTypeModel gameType)
 {
     try
     {
         GameTypeModel _gameType = context.GameTypeModels.Find(gameType.GameTypeID);
         context.Entry(_gameType).CurrentValues.SetValues(gameType);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         interfaceException = ex;
         WriteException(ex);
         return(DbError.FAILED_TO_UPDATE);
     }
     return(DbError.SUCCESS);
 }
Пример #2
0
        public DbError DeleteGameType(int gameTypeId)
        {
            GameTypeModel _gameType = context.GameTypeModels.Find(gameTypeId);

            try
            {
                context.GameTypeModels.Remove(_gameType);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                interfaceException = ex;
                WriteException(ex);
                return(DbError.FAILED_TO_DELETE);
            }
            return(DbError.SUCCESS);
        }