public IActionResult Create([FromBody] CategoryCreateDto categoryCreateDto) { CategoryCreateCommand categoryCreateCommand = MapService.Map(categoryCreateDto); Result result = _messages.Dispatch(categoryCreateCommand); return(FromResult(result)); }
public async Task <IActionResult> Post([FromBody] CategoryCreateCommand command) { var id = await _mediator.Send(command); return(await Get(id)); }
public CreateResponse Post(CategoryCreateCommand command) { var category = new Category { Id = Guid.NewGuid(), Name = command.Name, Frequency = command.Frequency }; repositoryUnitOfWork.Categories.Create(category); // create budget to category relationship repositoryUnitOfWork.Budgets.AddCategoryToBudget(category.Id, command.BudgetId); return new CreateResponse { Id = category.Id }; }
public Task CreateCategory([FromBody] CategoryCreateCommand categoryCreateCommand, CancellationToken cancellationToken) { return(mediator.Send(categoryCreateCommand, cancellationToken)); }