Пример #1
0
        public async Task <IActionResult> OnPostAsync(long sendAmount, string message, int reciveVetMemberId)
        {
            UserContext = CoreService.GetUserContext();
            if (UserContext == null)
            {
                return(NotFound());
            }

            if (sendAmount <= 0)
            {
                this.ModelState.AddModelError("sendAmount", "1以上の数を指定してください");
                return(OnGet(null));
            }
            if (UserContext.Amount < sendAmount)
            {
                this.ModelState.AddModelError("sendAmount", "残高が不足しています");
                return(OnGet(null));
            }

            CoreService.AddTransaction(UserContext, sendAmount, message, reciveVetMemberId, CoinTransactionType.Transfer);
            await CoreService.SavechanesAsnc();

            var reciveMember = DbContext.VetMembers.Find(reciveVetMemberId);
            var lastAmount   = CoreService.CalcAmount(reciveMember);

            await Notification(UserContext.CurrentUser, reciveMember, sendAmount, message, lastAmount);

            return(RedirectToPage("/index"));
        }