public async Task SetShares(string userID, string ticker, int amount) { UserShares SharesObj; try { SharesObj = new UserShares(await db.getJObjectAsync(userID, "shares"), true); } catch (System.NullReferenceException) { SharesObj = new UserShares(userID); } if (SharesObj.ownedShares.ContainsKey(ticker) == true) { SharesObj.ownedShares.Remove(ticker); } SharesObj.ownedShares.Add(ticker, amount); await db.SetJObjectAsync(db.SerializeObject <UserShares>(SharesObj), "shares"); }
public async Task setCompany(Company company) { await __database.SetJObjectAsync(company.SerializeIntoJObject(), "companies"); }
public async void SetResources(JObject resource) { await _database.SetJObjectAsync(resource, "resources", false); }