Exemplo n.º 1
0
        public IActionResult Remove([FromForm] int id)
        {
            bool isRemoveBlogTrue = _blogService.RemovePostFromID(id);

            if (isRemoveBlogTrue)
            {
                return(Json(new { status = 200, message = "Remove Complete" }));
            }
            return(Json(new { status = 500, message = "Server interval" }));
        }
Exemplo n.º 2
0
        public IActionResult DeletePost([FromForm] int id)
        {
            var roleId    = HttpContext.Items["RoleID"];
            var roldIdInt = int.Parse(roleId.ToString());

            if (roleId == null || roldIdInt != 1)
            {
                return(Json(new { status = 403, message = "Forbidden" }));
            }
            bool isRemoveBlogTrue = _blogService.RemovePostFromID(id);

            if (isRemoveBlogTrue)
            {
                return(Json(new { status = 200, message = "Remove Complete" }));
            }
            return(Json(new { status = 500, message = "Server interval" }));
        }
Exemplo n.º 3
0
 public bool RemovePostFromID(int blogID)
 {
     return(_blogservice.RemovePostFromID(blogID));
 }