コード例 #1
0
        public PostsResponse Delete(int id)
        {
            var context = new PersonalBlogEntities();

            if (context.Posts.FirstOrDefault(p => p.PostId == id) == null)
            {
                var response = new PostsResponse();
                response.Success = false;
                response.Message = "There is no post in our database that matches the delete criteria.";
                return(response);
            }

            return(repo.Delete(id));
        }
コード例 #2
0
 public void DeletePost()
 {
     PostsResponse response = repo.Delete(1);
     PostsResponse actual   = repo.GetById(1);
 }