Exemple #1
0
        public async Task <IActionResult> HardDelete(int id = 0)
        {
            Result result = new Result(false, "Unable to delete post at this time.");

            if (id != 0)
            {
                try
                {
                    await _post.DeletePostAsync(id);

                    result.Succeeded = true;
                    result.Message   = "Post deleted.";
                }
                catch (Exception ex)
                {
                    result.Message = "Unable to delete post at this time.";

                    SysException exception = new SysException(ex)
                    {
                        Url = UrlHelper.GetRequestUrl(HttpContext)
                    };
                }
            }

            return(Json(new { result }));
        }