public async Task <IActionResult> OnPostAsync() { var store = await _service.CreateAsync( ObjectMapper.Map <CreateEditStoreViewModel, CreateUpdateStoreDto>(Store)); return(NoContent()); }
public async Task Should_Create_A_Store() { // Arrange var request = new CreateUpdateStoreDto { Name = "New Store 2" }; // Act var response = await _storeAppService.CreateAsync(request); // Assert response.ShouldNotBeNull(); response.Name.ShouldBe("New Store 2"); UsingDbContext(db => { var store = db.Stores.FirstOrDefault(x => x.Id == response.Id); store.ShouldNotBeNull(); store.Name.ShouldBe("New Store 2"); }); }
public Task <StoreDto> CreateAsync(CreateUpdateStoreDto input) { return(_service.CreateAsync(input)); }