Пример #1
0
        public TodoItemRetrieve Get(string id)
        {
            var item    = _todoItemService.Retrieve(id);
            var history = _todoItemStatusHistoryService.RetrieveByTodoItemId(id).ToList();

            return(TodoItemMapper.ToController(item, history));
        }
Пример #2
0
        public IEnumerable <TodoItemRetrieve> GetAll()
        {
            var items   = _todoItemService.Retrieve();
            var history = _todoItemStatusHistoryService.Retrieve().GroupBy(h => h.TodoItemId).ToDictionary(g => g.Key, g => g.ToList());

            return(TodoItemMapper.ToController(items, history));
        }
Пример #3
0
        public TodoItemRetrieve Create(TodoItemCreate item)
        {
            var now    = DateTime.UtcNow;
            var status = TodoItemStatus.Pending;

            var objectToCreate = TodoItemMapper.ToDataAccess(item, now, status);

            var createdThing = _todoItemService.Create(objectToCreate);

            var history = MakeStatusHistory(createdThing.Id, status, now);

            return(TodoItemMapper.ToController(createdThing, new List <TodoItemStatusHistoryDataAccess> {
                history
            }));
        }