Beispiel #1
0
        public IActionResult GetAll()
        {
            var response = Tracker.Conversations.ToDictionary(
                entry => entry.Key,
                entry => entry.Value
                .Select(pm => PrivateMessageResponse.FromPrivateMessage(pm, self: pm.Username == ApplicationStateMonitor.CurrentValue.User.Username))
                .OrderBy(m => m.Timestamp));

            return(Ok(response));
        }
Beispiel #2
0
        public IActionResult GetByUsername([FromRoute] string username)
        {
            if (Tracker.TryGet(username, out var conversation))
            {
                var response = conversation
                               .Select(pm => PrivateMessageResponse.FromPrivateMessage(pm, self: pm.Username == ApplicationStateMonitor.CurrentValue.User.Username))
                               .OrderBy(m => m.Timestamp);

                return(Ok(response));
            }

            return(NotFound());
        }