public async Task <IActionResult> Synchronize()
        {
            string    token = Request.Headers["Authorization"].ToString().Substring("Bearer ".Length).Trim();
            UserModel user  = await _jwtTokenService.GetUserFromTokenStrAsync(token);

            ShoppingListModel res = await _shoppingListService.SynchronizeShoppingListAsync(user);

            return(Ok(res));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Synchronize()
        {
            string    token = Request.Headers["Authorization"].ToString().Substring("Bearer ".Length).Trim();
            UserModel user  = await _jwtTokenService.GetUserFromTokenStrAsync(token);

            List <ClientHouseworkModel> res = await _houseworkService.SynchronizeHouseworksAsync(user);

            return(Ok(res));
        }
        public async Task <IActionResult> AddExpense([FromBody] ClientExpenseModel clientExpense)
        {
            string    token = Request.Headers["Authorization"].ToString().Substring("Bearer ".Length).Trim();
            UserModel user  = await _jwtTokenService.GetUserFromTokenStrAsync(token);

            ExpenseModel expense      = clientExpense.Expense;
            List <int>   participants = clientExpense.Participants;

            await _userExpenseService.AddExpenseAsync(user, expense, participants);

            return(Ok());
        }
Exemplo n.º 4
0
        public async Task <IActionResult> CreateNewHome([FromBody] HomeModel home)
        {
            home.Name = home.Name.ToLower();

            string    token = Request.Headers["Authorization"].ToString().Substring("Bearer ".Length).Trim();
            UserModel user  = await _jwtTokenService.GetUserFromTokenStrAsync(token);

            await _homeService.CreateNewHomeAsync(user, home);

            return(Ok());
        }