예제 #1
0
 public int UpdatePost(PostSoap postSoap, CategorySoap[] categorySoapList)
 {
     try
     {
         List <CategoryDto> categoryDtoList = new List <CategoryDto>();
         foreach (CategorySoap categorySoap in categorySoapList)
         {
             categoryDtoList.Add(new CategoryDto
             {
                 Id           = categorySoap.Id,
                 CategoryName = categorySoap.CategoryName
             });
         }
         return(PostService.UpdatePost(new PostDto
         {
             Id = postSoap.Id,
             Title = postSoap.Title,
             Body = postSoap.Body,
             PostImage = postSoap.PostImage
         }, categoryDtoList));
     }
     catch (ApplicationException ex)
     {
         throw new FaultException(ex.Message);
     }
 }
예제 #2
0
 public int DeletePost(PostSoap postSoap)
 {
     try
     {
         return(PostService.DeletePost(new PostDto
         {
             Id = postSoap.Id
         }));
     }
     catch (ApplicationException ex)
     {
         throw new FaultException(ex.Message);
     }
 }
예제 #3
0
 public PostViewModel GetPost(int postId)
 {
     try
     {
         PostSoap post = PostServiceClient.GetPost(postId);
         return(new PostViewModel
         {
             Id = post.Id,
             Title = post.Title,
             Body = post.Body,
             CreationDate = post.CreationDate.ToString(),
             PostImage = post.PostImage
         });
     }
     catch (FaultException ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }