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)); }
/// <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 }); }
public static PostItem ToDomain(this PostItemDTO postItemDTO) { return(new PostItem { Text = postItemDTO.Text, UserId = postItemDTO.UserId }); }