public IHttpActionResult PutUserWallets(int id, UserWallets userWallets) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userWallets.Id) { return(BadRequest()); } db.Entry(userWallets).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UserWalletsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetUserWallets(int id) { UserWallets userWallets = db.User.Find(id); if (userWallets == null) { return(NotFound()); } return(Ok(userWallets)); }
public IHttpActionResult PostUserWallets(UserWallets userWallets) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.User.Add(userWallets); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = userWallets.Id }, userWallets)); }
public IHttpActionResult DeleteUserWallets(int id) { UserWallets userWallets = db.User.Find(id); if (userWallets == null) { return(NotFound()); } db.User.Remove(userWallets); db.SaveChanges(); return(Ok(userWallets)); }
private async Task fetchUser() { if (GlobalData.USER_RECORD_STRING != null) { // get phone number from global constants // fetch user details from the firebase FirebaseUser user = await firesharpClient.Get <FirebaseUser>("users/" + GlobalData.USER_RECORD_STRING); UserWallets = user.UserWallets; totalAmount = UserWallets.AsEnumerable().Sum(wallet => wallet.Amount); NotifyPropertyChanged("TotalText"); // calculate total Fetching = false; } }