Пример #1
0
        public ActionResult EditAccount(int ID)
        {
            account          acc    = accs.GetAccount(ID);
            AccountViewModel acc_vm = new AccountViewModel();
            var mapper_accs         = new MapperConfiguration(cfg => cfg.CreateMap <account, AccountViewModel>()).CreateMapper();
            var account             = mapper_accs.Map <account, AccountViewModel>(acc);

            return(View(account));
        }
        public async Task <IActionResult> Authenticate([FromBody] Account account)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var user = await _accountBusiness.GetAccount(account.Username, account.Password);

            if (user == null)
            {
                return(Unauthorized());
            }

            var tokenString = UserService.GenerateJsonWebToken(user, _appSettings);

            return(Ok(new { token = tokenString }));
        }
Пример #3
0
        public async Task <IActionResult> SendNotification(int id = 1)
        {
            var microkol = await _IAccountBusiness.GetAccount(id);

            var filter     = new AccountWithCategorySpecification(id);
            var influencer = await _IAccountRepository.GetSingleBySpecAsync(filter);

            ViewBag.Influencer = influencer;
            if (microkol == null)
            {
                TempData["MessageError"] = "Người ảnh hưởng không tồn tại!";
            }
            return(View(microkol));
        }
Пример #4
0
        public WalletViewModel Get(int id)
        {
            var             wallet           = _IWalletRepository.GetById(id);
            WalletViewModel _WalletViewModel = null;

            if (wallet != null)
            {
                _WalletViewModel = new WalletViewModel(wallet);
                if (wallet.EntityType == Core.Entities.EntityType.Account)
                {
                    _WalletViewModel.Name = _IAccountBusiness.GetAccount(wallet.EntityId).Result.Name;
                }
                else if (wallet.EntityType == Core.Entities.EntityType.Agency)
                {
                    _WalletViewModel.Name = _IAgencyBusiness.GetAgency(wallet.EntityId).Result.Name;
                }
            }

            return(_WalletViewModel);
        }
Пример #5
0
        public IActionResult Index(int pageindex = 1)
        {
            var list_wallet = _IWalletBusiness.GetListWallet(pageindex, 20);

            BuildFilterDataControl();
            if (list_wallet != null)
            {
                foreach (var item in list_wallet.Wallets)
                {
                    if (item.EntityType == Core.Entities.EntityType.Account)
                    {
                        var account = _IAccountBusiness.GetAccount(item.EntityId);
                        if (account.Result != null)
                        {
                            item.Name = account.Result.Name;
                            item.Type = account.Result.Type.ToString();
                        }
                    }
                    else if (item.EntityType == Core.Entities.EntityType.Agency)
                    {
                        var agency = _IAgencyBusiness.GetAgency(item.EntityId);
                        if (agency.Result != null)
                        {
                            item.Name = agency.Result.Name;
                        }
                    }
                }
            }
            return(View(list_wallet));
        }