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()); }
private CreateTodoOutput Persist(CreateTodoInput model) { var id = _respository.Create(model); _respository.Persist(); return(new CreateTodoOutput { Id = id }); }
private CreateTodoInput CreateTodoItemMessage(string itemDescription) { var message = new CreateTodoInput { ItemDescription = itemDescription, DueDate = DateTime.Parse("2017-01-01") }; return(message); }
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); }
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); }
private TodoItem MapInputToDomainEntity(CreateTodoInput input) { var model = _mapper.Map <TodoItem>(input); return(model); }