コード例 #1
0
 public static FeedItem UpdateFeedItem(this UpdateFeedItemViewModel model)
 {
     return(new FeedItem(model.Title, model.Description, model.Content, model.Tags, model.CommentsEnabled)
     {
         Id = model.Id
     });
 }
コード例 #2
0
        public async Task <IActionResult> Update([FromBody] UpdateFeedItemViewModel model)
        {
            try
            {
                var result = await _contentGrain.Update(new UpdateOperation <FeedItem>(CurrentUserHelper.UserId,
                                                                                       model.Id,
                                                                                       model.UpdateFeedItem()));

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