Exemplo n.º 1
0
        public async Task <IActionResult> Delete(RoleDeleteGet Role)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                //Role.CreatorId = CurrentUser.Id;
                //var CheckString = await _RoleProvider.DeletePostCheck(Role);
                //if (CheckString.Length == 0)
                //{
                _roleProvider.DeletePost(CurrentUser.Id, Role.RoleId);
                var x = await _roleManager.FindByIdAsync(Role.RoleId);

                _roleManager.DeleteAsync(x);
                return(Ok(Role));

                //}
                return(BadRequest(new
                {
                    IsSuccess = false,
                    //Message = CheckString,
                }));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Delete(RoleDeleteGet Page)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            await _client.PostProtectedAsync <RoleDeleteGet>($"{_configuration["APIUrl"]}api/Role/Delete", Page, token);

            //return RedirectToAction("Index", new { id = UserMenu.UserMenuTemplateId });
            return(RedirectToAction("Index"));
        }