private TodoItemEntityFrameworkModel MapToEntity(UpdateTodoInput item) { var entity = _mapper.Map <TodoItemEntityFrameworkModel>(item); entity.Id = item.Id; return(entity); }
public IHttpActionResult Execute([FromBody] UpdateTodoInput inputTo) { var presenter = CreatePresenter(); _useCase.Execute(inputTo, presenter); return(presenter.Render()); }
private UpdateTodoInput CreateTodoItem(Guid id) { var model = new UpdateTodoInput { Id = id, ItemDescription = "updated", IsCompleted = true, DueDate = DateTime.Today }; return(model); }
public void Execute(UpdateTodoInput inputTo, IRespondWithResultFreeSuccessOrError <ErrorOutputMessage> presenter) { var model = MapInputToModel(inputTo); if (InvalidId(model)) { RespondWithError("Id cannot be empty", presenter); return; } if (InvalidItemDescription(model)) { RespondWithError("ItemDescription cannot be null or empty", presenter); return; } UpdateTodoItem(inputTo); presenter.Respond(); }
private void AssertModelMatchesEntity(UpdateTodoInput model, TodoItemEntityFrameworkModel entity) { Assert.AreEqual(model.Id, entity.Id); Assert.AreEqual(model.ItemDescription, entity.ItemDescription); Assert.AreEqual(model.IsCompleted, entity.IsCompleted); }
private TodoItem MapInputToModel(UpdateTodoInput input) { var model = _mapper.Map <TodoItem>(input); return(model); }
private void UpdateTodoItem(UpdateTodoInput model) { _repository.Update(model); _repository.Persist(); }
public void Update(UpdateTodoInput item) { var entity = MapToEntity(item); _dbContext.TodoItem.AddOrUpdate(entity); }