public static FeedItem CreateFeedItem(this CreateFeedItemViewModel model)
 {
     return(new FeedItem(model.Title, model.Description, model.Content, model.Tags, model.CommentsEnabled)
     {
         FeedId = model.FeedId
     });
 }
예제 #2
0
 public async Task <IActionResult> FeedItem([FromBody] CreateFeedItemViewModel model)
 {
     try
     {
         return(Json(await _createContentGrain.CreateFeedItem(model, model.FeedId)));
     }
     catch (Exception ex)
     {
         return(ex.BadRequestFromException());
     }
 }
        public async Task <IActionResult> Create([FromBody] CreateFeedItemViewModel model)
        {
            try
            {
                var result =
                    await _contentGrain.Create(new CreateOperation <FeedItem>(CurrentUserHelper.UserId,
                                                                              model.CreateFeedItem()));

                return(result.Succeeded ? (IActionResult)Ok() : BadRequest(result));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }