public async Task <ActionResult> Post([FromForm] FeedStatusViewModel status) { _logger.LogDebug($"Updating user settings - show all: {status.ShowAll}; group: {status.Group}; expanded: {status.Expanded}"); var userAccount = await _userAccountRepository.FindOrCreateAsync(User); if (status.Expanded.HasValue && !string.IsNullOrEmpty(status.Group)) { if (status.Expanded.Value) { userAccount.ExpandedGroups.Add(status.Group); } else { userAccount.ExpandedGroups.Remove(status.Group); } } if (status.ShowAll.HasValue) { userAccount.ShowAllItems = status.ShowAll.Value; } await _userAccountRepository.UpdateAsync(userAccount); return(Ok()); }
private FeedStatusViewModel GetModel() { var model = new FeedStatusViewModel { FeedTokens = new List <FeedToken>() }; //WARNING: Reflection and accessing internal namespaces goes here... var t = _tokenStore.GetType(); var mi = t.GetMethod("LoadAll", BindingFlags.Instance | BindingFlags.NonPublic); if (mi != null) { var result = mi.Invoke(_tokenStore, null) as IEnumerable <object>; if (result != null) { foreach (var token in result) { var blobId = token.GetType().GetProperty("BlobId").GetValue(token) as Uri; var expires = token.GetType().GetProperty("Expires").GetValue(token) as DateTime?; var id = token.GetType().GetProperty("Id").GetValue(token) as Identity; model.FeedTokens.Add(new FeedToken() { BlobId = blobId, Expires = expires.Value, Id = id, BlobUrl = _urlHelper.GetDownloadUrl() + "?fileid=" + blobId }); } } } return(model); }