Пример #1
0
        public IActionResult OnPostDelete()
        {
            if (Id != null)
            {
                _teamManage.Delete(Id.Value);
            }

            return(RedirectToPage("/Team/Team"));
        }
Пример #2
0
        public IActionResult Delete(int teamId)
        {
            var team = _teamRepository.Get(teamId);

            if (team == null)
            {
                return(Json(new
                {
                    success = false,
                    errorMessage = "Invalid Team."
                }));
            }

            _teamManager.Delete(team);
            var redirectUrl = Url.Action(nameof(Index), "Team");

            return(Json(new
            {
                success = true,
                redirectUrl
            }));
        }