示例#1
0
        public async Task <int> Register(RegisterAgencyViewModel model)
        {
            var isvalid = await VerifyUsername(model.Username, model.Name);

            if (isvalid)
            {
                var agency = model.GetEntity();
                await _agencyRepository.AddAsync(agency);

                await _walletRepository.CreateWallet(EntityType.Agency, agency.Id);

                return(agency.Id);
            }
            return(-1);
        }
示例#2
0
        public async Task <IActionResult> AgencyRegister(RegisterAgencyViewModel model, string returnurl = "")
        {
            if (ModelState.IsValid)
            {
                var id = await _agencyService.Register(model);

                if (id > 0)
                {
                    this.AddAlertSuccess("Đăng ký doanh nghiệp thành công. Vui lòng chờ ban quản trị duyệt");
                    return(RedirectToAction("AgencyRegister"));
                }
                this.AddAlertDanger("Tên đăng nhập đã tồn tại");
            }
            return(View(model));
        }
示例#3
0
        public async Task <IActionResult> Register(RegisterAgencyViewModel model, string returnurl = "")
        {
            if (ModelState.IsValid)
            {
                var id = await _agencyService.Register(model);

                if (id > 0)
                {
                    try {
                        //return RedirectToAction("AgencyRegister");
                        var _agency = await _agencyService.GetAgencyById(id);

                        string from      = "*****@*****.**";
                        string to        = model.Username;
                        string subject   = "[MICROKOLS] Xác minh tài khoản doanh nghiệp";
                        string plainText = $"Chào {model.Name},";

                        string htmlText = "<p>Bạn đã đăng ký thành công một tài khoản tại MicroKOLs <b>như một doanh nghiệp!</b></p>";
                        htmlText += "<p>Vui lòng kích hoạt tài khoản và bắt đầu tạo chiến dịch của bạn bằng cách nhấn vào đường dẫn dưới đây:</p>";
                        htmlText += "<p><a clicktracking=off href=\"https://merchant.microkols.com/auth/identityverify/?ming=" + _agency.Id.ToString() + "\">kích hoạt tài khoản tại đây</a></p>";
                        htmlText += "<p>Nếu bạn có bất kỳ thắc mắc nào, hãy liên hệ với chúng tôi để nhận được sự hỗ trợ nhanh nhất.</p>";
                        htmlText += "<p>Email: [email protected] </p>";
                        htmlText += "<p><b>Hotline hỗ trợ: 0975119599</b> </p>";
                        htmlText += "<p>Cảm ơn bạn đã tham gia sử dụng trang Web của chúng tôi!</p>";
                        htmlText += "<p>Trân trọng,</p>";
                        htmlText += "<p><b>Phòng Dịch Vụ Khách Hàng</b></p>";
                        htmlText += "<p>Microkols Platform</p>";
                        await SendEmailHelpers.SendEmail(from, to, subject, plainText, htmlText, model.Name);

                        this.AddAlertSuccess("Bạn đã đăng ký tài khoản doanh nghiệp, vui lòng kiểm tra email để xác thực thông tin.");
                    }
                    catch (Exception ex) {
                        this.AddAlertDanger(ex.Message);
                    }
                }
                else
                {
                    this.AddAlertDanger("Tên hoặc email doanh nghiệp đã tồn tại, xin vui lòng kiểm tra lại.");
                }
            }
            return(View(model));
        }