/// <summary> /// 删除Blog /// </summary> /// <param name="id">blogId</param> /// <returns></returns> public async Task <ResponseModel> DeleteBlog(int id) { var result = await _context.Blogs.FindAsync(id); _context.Remove(result); var i = await _context.SaveChangesAsync(); if (i > 0) { return new ResponseModel() { code = 200, result = "Blog删除成功", data = "" } } ; else { return new ResponseModel() { code = 0, result = "Blog修删除失败", data = "" } }; }
/// <summary> /// 类别删除 /// </summary> /// <param name="CategoryId">类别id</param> /// <returns></returns> public async Task <ResponseModel> DeleteCategory(int CategoryId) { var result = _context.Categorys.Find(CategoryId); _context.Remove(result); var i = await _context.SaveChangesAsync(); if (i > 0) { return new ResponseModel() { code = 200, result = "类别删除成功", data = "" } } ; else { return new ResponseModel() { code = 0, result = "类别删除失败", data = "" } }; }