コード例 #1
0
 // PUT api/posts/5
 public void Put(int id, PostViewModel postViewModel)
 {
     var post = Mapper.Map<PostDto, PostViewModel>(iPublishService.GetById(id));
     if (post == null)
     {
         throw new HttpResponseException(HttpStatusCode.NotFound);
     }
     else
     {
         this.iPublishService.Edit(Mapper.Map<PostViewModel, PostDto>(postViewModel));
     }
 }
コード例 #2
0
 // POST api/posts
 public void Post(PostViewModel postViewModel)
 {
     this.iPublishService.Publish(Mapper.Map<PostViewModel, PostDto>(postViewModel));
 }