public async Task <IActionResult> Delete(PageSectionDeleteGet PageSection) { var CurrentUser = await _userManager.GetUserAsync(User); if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString())) { PageSection.UserId = CurrentUser.Id; //var CheckString = await _PageSectionProvider.DeletePostCheck(PageSection); //if (CheckString.Length == 0) //{ _pageSectionProvider.DeletePost(CurrentUser.Id, PageSection.PageSectionId); return(Ok(PageSection)); //} return(BadRequest(new { IsSuccess = false, //Message = CheckString, })); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }
public async Task <IActionResult> Delete(PageSectionDeleteGet PageSection) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } await _client.PostProtectedAsync <PageSectionDeleteGet>($"{_configuration["APIUrl"]}api/FrontUserPageSection/Delete", PageSection, token); return(RedirectToAction("Index", new { id = PageSection.PageId })); }