Exemplo n.º 1
0
        public async Task <IActionResult> Delete(string postId)
        {
            try
            {
                blogService.Delete(postId);
            }
            catch (Exception ex)
            {
                log.LogError(ex, ex.Message);
            }

            return(RedirectToAction("Posts", "Admin"));
        }
        // DELETE api/values/5
        public IHttpActionResult Delete(int id)
        {
            IHttpActionResult actionResult = null;

            try
            {
                var flag = service.Delete(id);
                actionResult = Ok(flag);
            }
            catch (Exception ex)
            {
                actionResult = BadRequest(ex.Message);
            }
            return(actionResult);
        }
Exemplo n.º 3
0
        public IActionResult Delete(int id)
        {
            var userName = User.Identity.Name;
            var post     = _db.Posts.FirstOrDefault(x => x.Id == id);

            if (userName != post.Author)
            {
                return(RedirectToAction("Error", "Blog"));
            }
            else
            {
                _blog.Delete(id);
            }

            return(RedirectToAction("Index", "Blog"));
        }
Exemplo n.º 4
0
 public TagMaster Delete(int TagMasterId)
 {
     return(blog.Delete(TagMasterId));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 物理删除数据 Delete(Guid Guid)
 /// </summary>
 /// <param name="guid">主键Id(int)</param>
 /// <returns>true:删除成功; false:删除失败</returns>
 public bool Delete(string guid)
 {
     return(_blog.Delete(guid));
 }