示例#1
0
        public async Task <GetFullHistoryHistoryView> GetFullHistory()
        {
            IEnumerable <History> history = await _historyProvider.GetAll();

            GetFullHistoryHistoryView historyViewModels = HistoryViewMapper.GetFullHistoryView(history);

            return(historyViewModels);
        }
示例#2
0
        public async Task <IHttpActionResult> GetFullHistory()
        {
            try
            {
                GetFullHistoryHistoryView view = await _service.GetFullHistory();

                return(Ok(view));
            }
            catch (Exception exception)
            {
                Log.Error(exception.ToString());
                return(InternalServerError(exception));
            }
        }
示例#3
0
        public static GetFullHistoryHistoryView GetFullHistoryView(IEnumerable <History> history)
        {
            var view      = new GetFullHistoryHistoryView();
            var viewItems = new List <EntryGetFullHistoryHistoryViewItem>();

            foreach (var entry in history)
            {
                var item = new EntryGetFullHistoryHistoryViewItem
                {
                    SessionId = entry.SessionId,
                    Time      = entry.CreationDate,
                    PlayerId  = entry.PlayerId,
                    Event     = entry.Event
                };
                viewItems.Add(item);
            }

            view.Entries = viewItems;

            return(view);
        }