示例#1
0
        public async Task <IActionResult> Delete(long id)
        {
            if (id <= 0)
            {
                SetTempDataErrorMessage("You didn't select a valid record to delete. Please select an existing record to delete.");
                return(RedirectToAction("Index"));
            }

            var userState = _userStateWrapper.GetUserState();

            if (id == userState.Id)
            {
                SetTempDataErrorMessage("You can not delete yourself.");
                return(RedirectToAction("Index"));
            }

            await _memberService.DeleteMemberAsync(id);

            return(RedirectToAction("Index"));
        }