示例#1
0
        public ActionResult UserCreation(string email, string type)
        {
            try
            {
                MongoDbRepository <UserToken> ut = new MongoDbRepository <UserToken>();

                var       token     = Guid.NewGuid().ToString();
                UserToken userToken = new UserToken();
                userToken.Token    = token;
                userToken.UserType = Convert.ToInt32(type);
                userToken.Email    = email;
                userToken.Created  = false;
                ut.Insert(userToken);
                //  string autority = _httpContextAccessor.Http;
                string host = _httpContextAccessor.HttpContext.Request.Host.Value;

                //HttpContext.Current.Request.Url.Authority
                EmailTokenSending.email_AdminsendToken(email, token, Convert.ToInt32(type), host);

                return(Json("Invite sent by Email to : " + email));
            }
            catch (Exception)
            {
                return(Json("Some Error"));
            }
        }
示例#2
0
        //[TaxProfessionalsAuthorizeAttribute]
        public async Task <ActionResult> InviteTrader(string email)
        {
            try
            {
                MongoDbRepository <UserToken> ut = new MongoDbRepository <UserToken>();

                var       token   = Guid.NewGuid().ToString();
                UserToken account = new UserToken();
                account.Token    = token;
                account.UserType = (int)UserType.Trader;
                account.Email    = email;
                // account.TaxProfessionalId = (await _userManager.FindByNameAsync(User.Identity.Name.ToString())).Id;
                // BuyerId =?null:(ObjectId)new ObjectId(buyerid),
                account.Created = false;
                //if (!(buyerid == "0"))
                //{
                //    account.BuyerId = (ObjectId)new ObjectId(buyerid);
                //}


                //acount.Token = token;
                //acount.UserType = type;
                //acount.Email = email;
                // BuyerId =?null:(ObjectId)new ObjectId(buyerid),
                account.Created = false;

                ut.Insert(account);
                string host = _httpContextAccessor.HttpContext.Request.Host.Value;
                EmailTokenSending.email_TradersendToken(email, token, Convert.ToInt32((int)UserType.Trader), host);

                // WattsAppSending.email_InviteTrader(email, token);

                return(View());
            }
            catch (Exception)
            {
                return(View());
            }
        }