/// <summary> /// Updates a game /// </summary> /// <param name="id">id of game</param> /// <param name="description">description of game</param> /// <param name="background">background of game</param> /// <param name="logo">logo of game</param> /// <param name="developerId">developer id of game</param> /// <param name="gameLink">link of game</param> /// <param name="gameName">name of game</param> /// <param name="price">price of game</param> public static void UpdateGame(int id, string description, string background, string logo, int developerId, string gameLink, string gameName, double price) { DalHelper.Update($@"UPDATE Games SET [Game Name] = @gameName, [Game Link] = @gameLink, [Description] = @desc, [Background] = @background, [Logo] = @logo, [Developer] = @dev, [Price] = @price WHERE ID = {id}", new OleDbParameter("@gameName", gameName), new OleDbParameter("@gameLink", gameLink), new OleDbParameter("@desc", description), new OleDbParameter("@background", background), new OleDbParameter("@logo", logo), new OleDbParameter("@dev", developerId), new OleDbParameter("@price", price)); }
/// <summary> /// Updates the data for the developer /// </summary> /// <param name="name">new developer name</param> /// <param name="about">new developer bio</param> /// <param name="id">id of developer</param> public static void UpdateData(string name, string about, int id) { DalHelper.Update($"UPDATE Developer SET [Developer Name] = @name, [About] = @about WHERE id = {id}", new OleDbParameter("@name", name), new OleDbParameter("@about", about)); }
/// <summary> /// updates the background for the developer /// </summary> /// <param name="filename">filename of background</param> /// <param name="id">id of developer</param> public static void UpdateBackground(string filename, int id) { DalHelper.Update($"UPDATE Developer SET [Background] = @name WHERE id = {id}", new OleDbParameter("@name", filename)); }
/// <summary> /// Adds a user to a developer company /// </summary> /// <param name="userId">id of user</param> /// <param name="devId">id of developer</param> public static void SetUserDeveloper(int userId, int devId) { DalHelper.Update($"UPDATE Users SET Developer = true, DeveloperId = {devId} WHERE ID = {userId}"); }
/// <summary> /// updates an existing review /// </summary> /// <param name="content">content of review</param> /// <param name="gameId">id of game</param> /// <param name="userId">id of user</param> /// <param name="stars">stars from 1-5</param> /// <returns>rows affected</returns> public static int UpdateReview(string content, int gameId, int userId, int stars) { return(DalHelper.Update( $"UPDATE GameReviews SET Content = '{content}', Stars = {stars} WHERE Game={gameId} AND [User]={userId}")); }
/// <summary> /// Removes the friend connection between user1 and user2 /// </summary> /// <param name="user1">user that is connected</param> /// <param name="user2">user that is connected</param> /// <returns>if it did anything</returns> public static bool RemoveFriend(int user1, int user2) { return(DalHelper.Update("DELETE FROM UserFriends WHERE" + $" (([User 1] = {user1} AND [User 2] = {user2})" + $" OR ([User 2] = {user1} AND [User 1] = {user2}))") > 0); }
/// <summary> /// Denies a friend request from user1 to user2 /// </summary> /// <param name="user1">user that sent the request</param> /// <param name="user2">user that denied the request</param> /// <returns>if it did anything</returns> public static bool DenyFriendRequest(int user1, int user2) { return(DalHelper.Update($"DELETE FROM UserFriends WHERE [User 1] = {user1} AND [User 2] = {user2}") > 0); }
/// <summary> /// deletes all genres of a game /// </summary> /// <param name="game">id of game</param> public static void DeleteGenresForGame(int game) { var sql = $@"DELETE * FROM GameGenres WHERE Game = {game}"; DalHelper.Update(sql); }