public async Task <IActionResult> PostItemAsync(PostItemDTO postItem)
        {
            var _postItem = postItem.ToDomain();

            var result = await this.postItemService.CreatePostItem(_postItem);

            if (result.Count() > 0)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, result));
            }

            return(StatusCode(StatusCodes.Status201Created));
        }
예제 #2
0
 /// <summary>
 /// Mapear hacia objeto de dominio
 /// </summary>
 /// <param name="postItemDTO"></param>
 /// <returns></returns>
 public static PostItem ADominio(this PostItemDTO postItemDTO)
 {
     return(new PostItem {
         Texto = postItemDTO.Texto, UserId = postItemDTO.UserId
     });
 }
예제 #3
0
 public static PostItem ToDomain(this PostItemDTO postItemDTO)
 {
     return(new PostItem {
         Text = postItemDTO.Text, UserId = postItemDTO.UserId
     });
 }