Esempio n. 1
0
        public async Task <IActionResult> WithdrawnAsync(WithdrawnInfo withdrawn)
        {
            string message = string.Empty;

            if (ModelState.IsValid)
            {
                // withdrawn service
                if (_user.WithdrawnUser(withdrawn) > 0)
                {
                    TempData["Message"] = "You successed the withdrawn the account";

                    await _context.SignOutAsync(scheme : CookieAuthenticationDefaults.AuthenticationScheme);

                    return(RedirectToAction("Index", "Membership"));
                }
                else
                {
                    message = "The processing of withdrawn the account is not worked";
                }
            }
            else
            {
                message = "You must input the information to witdraw the account";
            }
            ViewData["Message"] = message;
            return(View(withdrawn));
        }
Esempio n. 2
0
        public async Task <IActionResult> WithdrawnAsync(WithdrawnInfo withdrawn)
        {
            string message = string.Empty;

            if (ModelState.IsValid)
            {
                //탈퇴 서비스
                if (_user.WithdrawnUser(withdrawn) > 0)
                {
                    TempData["Message"] = "사용자 탈퇴가 성공적으로 이루어졌습니다.";

                    await _context.SignOutAsync(scheme : CookieAuthenticationDefaults.AuthenticationScheme);

                    return(RedirectToAction("Index", "Membership"));
                }
                else
                {
                    message = "사용자가 탈퇴처리되지 않았습니다.";
                }
            }
            else
            {
                message = "사용자가 탈퇴하기 위한 정보를 올바르게 입력하세요.";
            }

            ViewData["Message"] = message;
            return(View("Index", withdrawn));
        }
        private int WithdrawnUser(WithdrawnInfo user)
        {
            var userInfo = _context.Users.Where(u => u.UserId.Equals(user.UserId)).FirstOrDefault();

            if (userInfo == null)
            {
                return(0);
            }
            bool check       = _hasher.CheckThePasswordInfo(user.UserId, user.Password, userInfo.GUIDSalt, userInfo.RNGSalt, userInfo.PasswordHash);
            int  rowAffected = 0;

            if (check)
            {
                _context.Remove(userInfo);

                rowAffected = _context.SaveChanges();
            }
            return(rowAffected);
        }
Esempio n. 4
0
 int IUser.WithdrawnUser(WithdrawnInfo user)
 {
     return(WithdrawnUser(user));
 }