public Guid Create(CreateTodoInput item)
        {
            var entity = _mapper.Map <TodoItemEntityFrameworkModel>(item);

            _dbContext.TodoItem.Add(entity);
            return(entity.Id);
        }
        public IHttpActionResult Execute([FromBody] CreateTodoInput input)
        {
            var presenter = CreatePresenter();

            _useCase.Execute(input, presenter);

            return(presenter.Render());
        }
예제 #3
0
        private CreateTodoOutput Persist(CreateTodoInput model)
        {
            var id = _respository.Create(model);

            _respository.Persist();
            return(new CreateTodoOutput {
                Id = id
            });
        }
예제 #4
0
        private CreateTodoInput CreateTodoItemMessage(string itemDescription)
        {
            var message = new CreateTodoInput
            {
                ItemDescription = itemDescription,
                DueDate         = DateTime.Parse("2017-01-01")
            };

            return(message);
        }
예제 #5
0
        private CreateTodoInput CreateTodoItemMessage(string itemText, string itemDueDate)
        {
            var inputMessage = new CreateTodoInput
            {
                ItemDescription = itemText,
                DueDate         = DateTime.Parse(itemDueDate)
            };

            return(inputMessage);
        }
        private CreateTodoInput CreateTodoItem(string itemDescription, DateTime?dueDate)
        {
            var inputMessage = new CreateTodoInput
            {
                ItemDescription = itemDescription,
                DueDate         = dueDate
            };

            return(inputMessage);
        }
예제 #7
0
        public void Execute(CreateTodoInput inputTo, IRespondWithSuccessOrError <CreateTodoOutput, ErrorOutputMessage> presenter)
        {
            var domainEntity = MapInputToDomainEntity(inputTo);

            if (InvalidItemDescription(domainEntity))
            {
                RespondWithInvalidItemDescription(presenter);
                return;
            }

            var output = Persist(inputTo);

            RespondWithSuccess(presenter, output);
        }
예제 #8
0
        private TodoItem MapInputToDomainEntity(CreateTodoInput input)
        {
            var model = _mapper.Map <TodoItem>(input);

            return(model);
        }