public DbError UpdateGameType(GameTypeModel gameType) { try { GameTypeModel _gameType = context.GameTypes.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); }
public DbError DeleteGameType(GameTypeModel gameType) { GameTypeModel _gameType = context.GameTypes.Find(gameType.GameTypeID); try { context.GameTypes.Remove(_gameType); context.SaveChanges(); } catch (Exception ex) { interfaceException = ex; WriteException(ex); return(DbError.FAILED_TO_DELETE); } return(DbError.SUCCESS); }