diff --git a/H_PLUS_Sports/Controllers/CustomersController.cs b/H_PLUS_Sports/Controllers/CustomersController.cs index 9ad7c3a..678f543 100644 --- a/H_PLUS_Sports/Controllers/CustomersController.cs +++ b/H_PLUS_Sports/Controllers/CustomersController.cs @@ -71,9 +71,23 @@ namespace HPlusSportsAPI.Controllers } _context.Entry(customer).State = EntityState.Modified; + try + { + await _context.SaveChangesAsync(); + return Ok(customer); - await _context.SaveChangesAsync(); - return Ok(customer); + } + catch (DbUpdateConcurrencyException ) + { + if (!CustomerExists(id)) + { + return NotFound(); + } + else + { + throw; + } + } } [HttpPost] diff --git a/H_PLUS_Sports/Properties/launchSettings.json b/H_PLUS_Sports/Properties/launchSettings.json index 6e5b2c5..9b485c0 100644 --- a/H_PLUS_Sports/Properties/launchSettings.json +++ b/H_PLUS_Sports/Properties/launchSettings.json @@ -3,15 +3,14 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:50683", - "sslPort": 44368 + "applicationUrl": "http://localhost:44368", + "sslPort": 0 } }, "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { "IIS Express": { "commandName": "IISExpress", - "launchUrl": "weatherforecast", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }