public async Task <ActionResult> DeleteAsync(int categoryId) { var userId = _claimsGetter.UserId(User?.Claims); var shop = await _usersService.GetShopByUserIdAsync(userId); ShopCategoryViewModel shopCategory = new ShopCategoryViewModel { CategoryId = categoryId, ShopId = shop.Id }; await _shopCategoriesService.DeleteAsync(shopCategory); return(NoContent()); }
public async Task DeleteAsync_Calls_Mediator() { //Arrange var shopCategoryViewModel = new ShopCategoryViewModel { ShopId = 1, CategoryId = 1 }; //Act await _shopCategoryService.DeleteAsync(shopCategoryViewModel); //Assert _mockMediator.Verify(x => x.Send(It.IsAny <DeleteShopCategoryLinkCommand>(), default(CancellationToken)), Times.Once()); }
public Task SaveAsync(ShopCategoryViewModel viewModel) => _mediator.Send(new AddShopCategoryLinkCommand { ShopId = viewModel.ShopId, CategoryId = viewModel.CategoryId });