示例#1
0
        public async Task <IActionResult> Index([Bind("CustomerID,LastAmount,Balance,DepositID")] Deposit deposit)
        {
            var userID = _userManager.GetUserId(User);

            if (ModelState.IsValid)
            {
                var status = 1;
                deposit.CustomerID = userID;
                if (await _depositRepository.IsIDExists(userID))
                {
                    status = 2;
                    await _depositRepository.Update(deposit);
                }
                else
                {
                    await _depositRepository.Add(deposit);
                }
                return(RedirectToAction(nameof(Index), new { id = 0, status, customerID = "" }));
            }
            ViewData["DepositList"] = await _depositRepository.FindAll(userID);

            return(View(deposit));
        }
示例#2
0
        public async Task Add(Deposit deposit)
        {
            await _DepositRepository.Add(deposit);

            await _depositTypeRepo.SaveAsync();
        }