예제 #1
0
        public async Task <IActionResult> Delete(MetaContentDeleteGet MetaContent)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                MetaContent.UserId = CurrentUser.Id;
                //var CheckString = await _MetaContentProvider.DeletePostCheck(MetaContent);
                //if (CheckString.Length == 0)
                //{
                _metaContentProvider.DeletePost(CurrentUser.Id, MetaContent.MetaContentId);
                return(Ok(MetaContent));

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

            return(RedirectToAction("Index", new { id = MetaContent.MetaContentId, MetaTypeId = MetaContent.MetaTypeId }));
        }