public async Task <IActionResult> CreateStore(StoreUpsertInput input) { _logger.LogInformation("Creating a store", input); var persistedStore = await _storeRepository.Insert(input.Name); return(Created($"/stores/{persistedStore.Id}", persistedStore.Convert())); }
public async Task <IActionResult> UpdateStore(int id, StoreUpsertInput input) { _logger.LogInformation("Updating a store", input); try { var store = await _storeRepository.Update(id, input.Name, input.Address, input.Region); return(Accepted(store.Convert())); } catch (NotFoundException) { return(NotFound()); } }
public async Task <IActionResult> updateStore(int Id, StoreUpsertInput store) { // Code that checks if the given address exists var addresses = await _basisRegisterService .AddressMatchAsync(store.Region, null, null, null, null, store.Address, store.StreetNumber, null, null); addresses.Warnings.ToList().ForEach(x => _logger.LogWarning($"{x.Code} {x.Message}")); if (!addresses.Warnings.Any()) { // Code that updates a store. _logger.LogInformation("Updating a store", store); var persistedStore = await _storesRepository.Update(store.Id, store.Name, store.Address, store.StreetNumber, store.Region); return(Accepted()); } else { return(Ok("The given address does not exist!")); } }