예제 #1
0
        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));
        }
예제 #2
0
        public IHttpActionResult GetUserWallets(int id)
        {
            UserWallets userWallets = db.User.Find(id);

            if (userWallets == null)
            {
                return(NotFound());
            }

            return(Ok(userWallets));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }
예제 #5
0
        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;
            }
        }