Exemplo n.º 1
0
        public async Task <Guid> Store(SavingGoal goal)
        {
            User       user   = new User();
            HttpClient client = new HttpClient();

            var req = await client.GetAsync("https://localhost:5001/users/parser");

            Task <string> c = req.Content.ReadAsStringAsync();

            var res = JsonConvert.DeserializeObject <List <User> >(c.Result);

            foreach (var g in res)
            {
                if (g.Logged == true)
                {
                    user = new User()
                    {
                        Id        = g.Id,
                        Gmail     = g.Gmail,
                        Card      = g.Card,
                        Cash      = g.Cash,
                        FullName  = g.FullName,
                        UserImage = g.UserImage,
                        Logged    = true,
                        Password  = g.Password
                    };
                }
            }
            goal.UserId = user.Id;
            return(await _savingGoalsRepository.Create(goal));
        }
 public async Task<Guid> Store(SavingGoal goal)
 {
     goal.UserId = Domain.Constants.Constants.TestUserId;
     return await _savingGoalsRepository.Create(goal);
 }