コード例 #1
0
        protected async Task <IHttpActionResult> CurrentAccountExecuteAsync(AccountExecuteHandlerAsync handler, string email, bool isIncludeSubEmails = false)
        {
            try
            {
                var account = await _auth.AccountGetAsync(email, isIncludeSubEmails : isIncludeSubEmails);

                if (object.Equals(account, null))
                {
                    return(AccountNotFound());
                }

                return(await handler(account));
            }
            catch (Exception exc) { return(ErrorContent(exc)); }
        }
コード例 #2
0
        protected async Task <IHttpActionResult> AccountExecuteAsync(AccountExecuteHandlerAsync handler, AuthViewModel model)
        {
            try
            {
                var user = await _auth.AccountGetAsync(model.Email);

                if (object.Equals(user, null) || user.IsAnonymous)
                {
                    return(AccountNotFound());
                }

                return(await handler(user));
            }
            catch (Exception exc) { return(Request.HttpExceptionResult(exc)); }
        }
コード例 #3
0
        protected async Task <IHttpActionResult> CurrentAccountExecuteAsync(AccountExecuteHandlerAsync handler, Guid accountId)
        {
            try
            {
                var account = await _auth.AccountGetAsync(accountId);

                if (object.Equals(account, null))
                {
                    return(AccountNotFound());
                }

                return(await handler(account));
            }
            catch (Exception exc) { return(ErrorContent(exc)); }
        }
コード例 #4
0
        protected async Task <IHttpActionResult> CurrentAccountExecuteAsync(AccountExecuteHandlerAsync handler)
        {
            try
            {
                Guid userId;
                if (!Guid.TryParse(User.Identity.GetUserId(), out userId))
                {
                    return(AccountNotFound());
                }

                var user = await _auth.AccountGetAsync(userId);

                if (object.Equals(user, null))
                {
                    return(AccountNotFound());
                }

                return(await handler(user));
            }
            catch (Exception exc) { return(Request.HttpExceptionResult(exc)); }
        }