Beispiel #1
0
        public BudgetChooserResult ChooseBudget(string reason = "")
        {
            var tu = _pm.GetUsersList().AllUsers();

            tu.Wait();

            var userId = ChooseUserId(tu.Result);

            var budgets = _pm.GetBudgetsList().GetBudgetsUserCanView(new MyBudget.Domain.Users.UserId(userId));

            var budgetId = ChooseBudgetId(budgets, reason);

            return(new BudgetChooserResult
            {
                UserId = userId,
                BudgetId = budgetId,
            });
        }
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //var userId = Thread.CurrentPrincipal.Identity.Name;

            var userId = User.Identity.GetUserId();

            var users = ProjectionManager.GetUsersList();

            //var task = users.FindByIdAsync(userId);
            //var user = task.Result;
            try
            {
                var user = users.FindById(userId);
                //if (user == null)
                //    throw new Exception("Utente non è riconosciuto dal sistema");

                _userId = new UserId(userId);
            }
            catch
            {
            }
        }