Swagger Documentation Enhancement (273)

This commit is contained in:
Santhosh S
2023-08-24 21:25:38 -04:00
parent 9345ee2ca5
commit e56ffae1a4
22 changed files with 288 additions and 49 deletions

View File

@ -14,7 +14,10 @@ namespace DamageAssesment.Api.Locations.Controllers
{
this.LocationProvider = LocationsProvider;
}
// Get all Locations
/// <summary>
/// Get all locations.
/// </summary>
[HttpGet("Locations")]
public async Task<ActionResult> GetLocationsAsync()
{
@ -27,7 +30,10 @@ namespace DamageAssesment.Api.Locations.Controllers
return NotFound();
}
// Get all Location based on Id
/// <summary>
/// Get all locations based on locationdId.
/// </summary>
[HttpGet("Locations/{id}")]
public async Task<ActionResult> GetLocationByIdAsync(string id)
{
@ -40,7 +46,10 @@ namespace DamageAssesment.Api.Locations.Controllers
return NotFound();
}
// Update Location entity
/// <summary>
/// Update a Location.
/// </summary>
[HttpPut("Locations")]
public async Task<IActionResult> UpdateLocation(Db.Location Location)
{
@ -55,7 +64,10 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return NotFound();
}
//save new location
/// <summary>
/// Save a new location.
/// </summary>
[HttpPost("Locations")]
public async Task<IActionResult> CreateLocation(Db.Location Location)
{
@ -70,7 +82,10 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return CreatedAtRoute("DefaultApi", new { id = Location.Id }, Location);
}
//delete existing location
/// <summary>
/// Delete an existing location.
/// </summary>
[HttpDelete("Locations/{id}")]
public async Task<IActionResult> DeleteLocation(string id)
{

View File

@ -13,8 +13,10 @@ namespace DamageAssesment.Api.Locations.Controllers
{
this.regionProvider = regionProvider;
}
/// <summary>
/// Get all regions.
/// </summary>
// Get all Regions
[HttpGet]
public async Task<ActionResult> GetRegionsAsync()
{
@ -25,6 +27,9 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return NoContent();
}
/// <summary>
/// GET request for retrieving a region by its ID.
/// </summary>
[HttpGet("{Id}")]
public async Task<ActionResult> GetRegionAsync(string Id)
@ -36,6 +41,9 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return NotFound();
}
/// <summary>
/// POST request for creating a new region.
/// </summary>
[HttpPost]
public async Task<ActionResult> PostRegionAsync(Models.Region region)
@ -47,6 +55,9 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return BadRequest(result.ErrorMessage);
}
/// <summary>
/// PUT request for updating an existing region.
/// </summary>
[HttpPut]
public async Task<ActionResult> PutRegionAsync(Models.Region region)
@ -61,6 +72,10 @@ namespace DamageAssesment.Api.Locations.Controllers
return BadRequest(result.ErrorMessage);
}
/// <summary>
/// DELETE request for deleting a region based on ID.
/// </summary>
[HttpDelete("{Id}")]
public async Task<ActionResult> DeleteRegionAsync(string Id)