diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/Controllers/AnswersController.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Controllers/AnswersController.cs
index 27f5c3c..a8fefff 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Answers/Controllers/AnswersController.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Controllers/AnswersController.cs
@@ -14,7 +14,10 @@ namespace DamageAssesment.Api.Answers.Controllers
public AnswersController(IAnswersProvider answersProvider) {
this.answerProvider=answersProvider;
}
- //get all answers
+ ///
+ /// Get all answers
+ ///
+
[HttpGet("Answers")]
public async Task GetAnswersAsync() {
@@ -26,7 +29,11 @@ namespace DamageAssesment.Api.Answers.Controllers
return NoContent();
}
- //get answer based on answerid
+ ///
+ /// Get an answer based on answerId.
+ ///
+
+
[HttpGet("Answers/{Id}")]
public async Task GetAnswerByIdAsync(int Id)
{
@@ -39,7 +46,9 @@ namespace DamageAssesment.Api.Answers.Controllers
return NotFound();
}
- // get all answers based on response id
+ ///
+ /// Get all answers based on responseId.
+ ///
[HttpGet("AnswersByResponse/{ResponseId}")]
public async Task GetAnswersByResponseId(int ResponseId)
{
@@ -50,7 +59,10 @@ namespace DamageAssesment.Api.Answers.Controllers
}
return NoContent();
}
- // get all answers based on question id
+ ///
+ /// Get all answers based on questionId.
+ ///
+
[HttpGet("AnswersByQuestion/{QuestionId}")]
public async Task AnswersByQuestionId(int QuestionId)
{
@@ -61,7 +73,9 @@ namespace DamageAssesment.Api.Answers.Controllers
}
return NotFound();
}
- //update existing answer
+ ///
+ /// Update an existing answer.
+ ///
[HttpPut("Answers")]
public async Task UpdateAnswer(Db.Answer answer)
@@ -80,7 +94,10 @@ namespace DamageAssesment.Api.Answers.Controllers
}
return NotFound();
}
- //save new answer
+ ///
+ /// Save a new answer.
+ ///
+
[HttpPost("Answers")]
public async Task CreateAnswer(Db.Answer answer)
{
@@ -95,7 +112,10 @@ namespace DamageAssesment.Api.Answers.Controllers
}
return CreatedAtRoute("DefaultApi", new { id = answer.Id }, answer);
}
- //delete existing answer
+ ///
+ /// Delete an existing answer.
+ ///
+
[HttpDelete("Answers/{id}")]
public async Task DeleteAnswer(int id)
{
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj b/DamageAssesmentApi/DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj
index ca5ee38..b60fc33 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj
+++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj
@@ -4,6 +4,7 @@
net6.0
enable
enable
+ True
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs
index 7630089..373d300 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs
@@ -2,6 +2,7 @@ using DamageAssesment.Api.Answers.Db;
using DamageAssesment.Api.Answers.Interfaces;
using DamageAssesment.Api.Answers.Providers;
using Microsoft.EntityFrameworkCore;
+using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
@@ -10,7 +11,14 @@ var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
+//builder.Services.AddSwaggerGen();
+builder.Services.AddSwaggerGen(c =>
+{
+ // Include XML comments from your assembly
+ var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
+ c.IncludeXmlComments(xmlPath);
+});
builder.Services.AddScoped();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
builder.Services.AddDbContext(option =>
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Attachments/Controllers/AttachmentsController.cs b/DamageAssesmentApi/DamageAssesment.Api.Attachments/Controllers/AttachmentsController.cs
index a86a151..11cec22 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Attachments/Controllers/AttachmentsController.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Attachments/Controllers/AttachmentsController.cs
@@ -19,7 +19,10 @@ namespace DamageAssesment.Api.Attachments.Controllers
this.AttachmentProvider = AttachmentsProvider;
this.UploadService = uploadService;
}
- //get all Attachments
+ ///
+ /// Get all attachments.
+ ///
+
[HttpGet("Attachments")]
public async Task GetAttachmentsAsync()
{
@@ -32,7 +35,9 @@ namespace DamageAssesment.Api.Attachments.Controllers
return NoContent();
}
- //get all Attachment by Id
+ ///
+ /// Get all attachments by attachmentId.
+ ///
[HttpGet("Attachments/{id}")]
public async Task GetAttachmentbyIdAsync(int id)
{
@@ -73,7 +78,10 @@ namespace DamageAssesment.Api.Attachments.Controllers
// }
//}
- //Save new Attachment
+ ///
+ /// Save new Attachment(s)
+ ///
+
[HttpPost("Attachments"), DisableRequestSizeLimit]
public async Task UploadAttachmentAsync(AttachmentInfo attachmentInfo)
{
@@ -97,8 +105,10 @@ namespace DamageAssesment.Api.Attachments.Controllers
return BadRequest($"Internal server error: {ex}");
}
}
+ ///
+ /// Modify an new attachment.
+ ///
- //Save new Attachment
[HttpPut("Attachments"), DisableRequestSizeLimit]
public async Task UpdateAttachmentAsync(AttachmentInfo attachmentInfo)
{
@@ -126,7 +136,9 @@ namespace DamageAssesment.Api.Attachments.Controllers
return BadRequest($"Internal server error: {ex}");
}
}
- //delete existing Attachment
+ ///
+ /// Delete an existing attachment.
+ ///
[HttpDelete("Delete")]
public async Task DeleteAttachment(int Id)
{
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj b/DamageAssesmentApi/DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj
index 3454bff..846a5c2 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj
+++ b/DamageAssesmentApi/DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj
@@ -4,6 +4,7 @@
net6.0
enable
enable
+ True
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Attachments/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Attachments/Program.cs
index d661ef6..61ce1c5 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Attachments/Program.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Attachments/Program.cs
@@ -4,6 +4,7 @@ using DamageAssesment.Api.Attachments.Providers;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.FileProviders;
+using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
@@ -12,7 +13,14 @@ var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
+//builder.Services.AddSwaggerGen();
+builder.Services.AddSwaggerGen(c =>
+{
+ // Include XML comments from your assembly
+ var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
+ c.IncludeXmlComments(xmlPath);
+});
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Controllers/EmployeesController.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Controllers/EmployeesController.cs
index 192a9d0..a074f21 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Controllers/EmployeesController.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Controllers/EmployeesController.cs
@@ -15,7 +15,11 @@ namespace DamageAssesment.Api.Employees.Controllers
{
this.EmployeeProvider = EmployeesProvider;
}
- //get all Employees
+
+ ///
+ /// GET request for retrieving employees.
+ ///
+
[HttpGet("Employees")]
public async Task GetEmployeesAsync()
{
@@ -28,7 +32,11 @@ namespace DamageAssesment.Api.Employees.Controllers
return NoContent();
}
- //get Employee based on Employeeid
+
+ ///
+ /// GET request for retrieving an employee by ID.
+ ///
+
[HttpGet("Employees/{Id}")]
public async Task GetEmployeeByIdAsync(string Id)
{
@@ -41,8 +49,11 @@ namespace DamageAssesment.Api.Employees.Controllers
return NotFound();
}
- //update existing Employee
-
+
+ ///
+ /// PUT request for updating an existing employee.
+ ///
+ /// The updated employee object.
[HttpPut("Employees")]
public async Task UpdateEmployee(Db.Employee Employee)
{
@@ -60,7 +71,11 @@ namespace DamageAssesment.Api.Employees.Controllers
}
return NotFound();
}
- //save new Employee
+
+ ///
+ /// POST request for creating a new employee.
+ ///
+ /// The employee information for creating a new employee.
[HttpPost("Employees")]
public async Task CreateEmployee(Db.Employee Employee)
{
@@ -75,7 +90,10 @@ namespace DamageAssesment.Api.Employees.Controllers
}
return CreatedAtRoute("DefaultApi", new { id = Employee.Id }, Employee);
}
- //delete existing Employee
+ ///
+ /// DELETE request for deleting an existing employee.
+ ///
+ /// The ID of the employee to be deleted.
[HttpDelete("Employees/{id}")]
public async Task DeleteEmployee(string id)
{
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj b/DamageAssesmentApi/DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj
index 53e8700..7f05c71 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj
+++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj
@@ -1,9 +1,10 @@
-
+
net6.0
enable
enable
+ True
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs
index 29b91fa..7d5dbff 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs
@@ -2,6 +2,7 @@ using DamageAssesment.Api.Employees.Db;
using DamageAssesment.Api.Employees.Interfaces;
using DamageAssesment.Api.Employees.Providers;
using Microsoft.EntityFrameworkCore;
+using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
@@ -10,7 +11,15 @@ var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
+//builder.Services.AddSwaggerGen();
+builder.Services.AddSwaggerGen(c =>
+{
+ // Include XML comments from your assembly
+ var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
+ c.IncludeXmlComments(xmlPath);
+});
+
builder.Services.AddScoped();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
builder.Services.AddDbContext(option =>
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Controllers/LocationsController.cs b/DamageAssesmentApi/DamageAssesment.Api.Locations/Controllers/LocationsController.cs
index c1df10f..040bd93 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Controllers/LocationsController.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Controllers/LocationsController.cs
@@ -14,7 +14,10 @@ namespace DamageAssesment.Api.Locations.Controllers
{
this.LocationProvider = LocationsProvider;
}
- // Get all Locations
+ ///
+ /// Get all locations.
+ ///
+
[HttpGet("Locations")]
public async Task GetLocationsAsync()
{
@@ -27,7 +30,10 @@ namespace DamageAssesment.Api.Locations.Controllers
return NotFound();
}
- // Get all Location based on Id
+ ///
+ /// Get all locations based on locationdId.
+ ///
+
[HttpGet("Locations/{id}")]
public async Task GetLocationByIdAsync(string id)
{
@@ -40,7 +46,10 @@ namespace DamageAssesment.Api.Locations.Controllers
return NotFound();
}
- // Update Location entity
+ ///
+ /// Update a Location.
+ ///
+
[HttpPut("Locations")]
public async Task UpdateLocation(Db.Location Location)
{
@@ -55,7 +64,10 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return NotFound();
}
- //save new location
+ ///
+ /// Save a new location.
+ ///
+
[HttpPost("Locations")]
public async Task CreateLocation(Db.Location Location)
{
@@ -70,7 +82,10 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return CreatedAtRoute("DefaultApi", new { id = Location.Id }, Location);
}
- //delete existing location
+ ///
+ /// Delete an existing location.
+ ///
+
[HttpDelete("Locations/{id}")]
public async Task DeleteLocation(string id)
{
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Controllers/RegionsController.cs b/DamageAssesmentApi/DamageAssesment.Api.Locations/Controllers/RegionsController.cs
index 64a9bc7..81725e4 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Controllers/RegionsController.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Controllers/RegionsController.cs
@@ -13,8 +13,10 @@ namespace DamageAssesment.Api.Locations.Controllers
{
this.regionProvider = regionProvider;
}
+ ///
+ /// Get all regions.
+ ///
- // Get all Regions
[HttpGet]
public async Task GetRegionsAsync()
{
@@ -25,6 +27,9 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return NoContent();
}
+ ///
+ /// GET request for retrieving a region by its ID.
+ ///
[HttpGet("{Id}")]
public async Task GetRegionAsync(string Id)
@@ -36,6 +41,9 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return NotFound();
}
+ ///
+ /// POST request for creating a new region.
+ ///
[HttpPost]
public async Task PostRegionAsync(Models.Region region)
@@ -47,6 +55,9 @@ namespace DamageAssesment.Api.Locations.Controllers
}
return BadRequest(result.ErrorMessage);
}
+ ///
+ /// PUT request for updating an existing region.
+ ///
[HttpPut]
public async Task PutRegionAsync(Models.Region region)
@@ -61,6 +72,10 @@ namespace DamageAssesment.Api.Locations.Controllers
return BadRequest(result.ErrorMessage);
}
+ ///
+ /// DELETE request for deleting a region based on ID.
+ ///
+
[HttpDelete("{Id}")]
public async Task DeleteRegionAsync(string Id)
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj b/DamageAssesmentApi/DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj
index 47751c7..7f05c71 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj
+++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj
@@ -4,6 +4,7 @@
net6.0
enable
enable
+ True
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs
index a2e3149..c152e61 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs
@@ -2,6 +2,7 @@ using DamageAssesment.Api.Locations.Db;
using DamageAssesment.Api.Locations.Interfaces;
using DamageAssesment.Api.Locations.Providers;
using Microsoft.EntityFrameworkCore;
+using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
@@ -10,8 +11,14 @@ var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
-
+//builder.Services.AddSwaggerGen();
+builder.Services.AddSwaggerGen(c =>
+{
+ // Include XML comments from your assembly
+ var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
+ c.IncludeXmlComments(xmlPath);
+});
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Controllers/QuestionsController.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Controllers/QuestionsController.cs
index 0184d72..2519941 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Controllers/QuestionsController.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Controllers/QuestionsController.cs
@@ -19,7 +19,10 @@ namespace DamageAssesment.Api.Questions.Controllers
this.questionsProvider = questionsProvider;
}
- // get all questions
+ ///
+ /// GET request for retrieving questions.
+ ///
+
[HttpGet("Questions")]
public async Task GetQuestionsAsync()
{
@@ -30,7 +33,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
return NoContent();
}
- //Get questions based on question id
+ ///
+ /// GET request for retrieving a question by ID.
+ ///
+
[HttpGet("Questions/{id}")]
public async Task GetQuestionAsync(int id)
{
@@ -41,7 +47,11 @@ namespace DamageAssesment.Api.Questions.Controllers
}
return NotFound();
}
- //get all questions based on survey id
+ ///
+ /// GET request for retrieving survey questions based on a survey ID.
+ /// Uri: {Optional language}/GetSurveyQuestions/{surveyId} :Default returns question in all languages
+ ///
+
[HttpGet("GetSurveyQuestions/{surveyId}")]
public async Task GetSurveyQuestions(int surveyId,string? Language)
{
@@ -53,7 +63,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
return NotFound();
}
- //update existing question
+ ///
+ /// PUT request for updating a question (multilingual).
+ ///
+
[HttpPut("Questions")]
public async Task UpdateQuestion(Models.Question question)
{
@@ -71,7 +84,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
return CreatedAtRoute("DefaultApi", new { id = question.Id }, question);
}
- //save new question
+ ///
+ /// POST request for creating a new question (multilingual).
+ ///
+
[HttpPost("Questions")]
public async Task CreateQuestion(Models.Question question)
{
@@ -86,7 +102,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
return CreatedAtRoute("DefaultApi", new { id = question.Id }, question);
}
- // delete existing question
+ ///
+ /// DELETE request for deleting a question based on ID.
+ ///
+
[HttpDelete("Questions/{id}")]
public async Task DeleteQuestion(int id)
{
@@ -99,7 +118,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
- // get all questions
+ ///
+ /// GET request for retrieving question categories.
+ ///
+
[HttpGet("QuestionCategories")]
public async Task GetQuestionCategoriesAsync()
{
@@ -110,7 +132,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
return NoContent();
}
- //Get questions based on question id
+ ///
+ /// GET request for retrieving a question category by ID.
+ ///
+
[HttpGet("QuestionCategories/{id}")]
public async Task GetQuestionCategoryAsync(int id)
{
@@ -123,7 +148,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
- //update existing question
+ ///
+ /// PUT request for updating a question category.
+ ///
+
[HttpPut("QuestionCategories")]
public async Task UpdateQuestionCategory(Models.QuestionCategory questionCategory)
{
@@ -141,7 +169,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
return CreatedAtRoute("DefaultApi", new { id = questionCategory.Id }, questionCategory);
}
- //save new question
+ ///
+ /// POST request for creating a new question category.
+ ///
+
[HttpPost("QuestionCategories")]
public async Task CreateQuestionCategory(Models.QuestionCategory questionCategory)
{
@@ -156,7 +187,10 @@ namespace DamageAssesment.Api.Questions.Controllers
}
return CreatedAtRoute("DefaultApi", new { id = questionCategory.Id }, questionCategory);
}
- // delete existing question
+ ///
+ /// DELETE request for deleting a question category based on ID.
+ ///
+
[HttpDelete("QuestionCategories/{id}")]
public async Task DeleteQuestionCategory(int id)
{
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj b/DamageAssesmentApi/DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj
index 53e8700..7f05c71 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj
+++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj
@@ -1,9 +1,10 @@
-
+
net6.0
enable
enable
+ True
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs
index 3774b0b..321c989 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs
@@ -3,6 +3,7 @@ using DamageAssesment.Api.Questions.Interfaces;
using DamageAssesment.Api.Questions.Providers;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
+using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
@@ -17,7 +18,14 @@ builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
+//builder.Services.AddSwaggerGen();
+builder.Services.AddSwaggerGen(c =>
+{
+ // Include XML comments from your assembly
+ var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
+ c.IncludeXmlComments(xmlPath);
+});
builder.Services.AddDbContext(option =>
{
option.UseInMemoryDatabase("Questions");
diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Controllers/SurveyResponsesController.cs b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Controllers/SurveyResponsesController.cs
index 42b29dc..b3ff885 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Controllers/SurveyResponsesController.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Controllers/SurveyResponsesController.cs
@@ -16,6 +16,9 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
{
this.surveyResponseProvider = surveyResponseProvider;
}
+ ///
+ /// GET request for retrieving survey responses.
+ ///
[HttpGet("SurveyResponses")]
public async Task GetSurveyResponsesAsync()
@@ -31,7 +34,10 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
return BadRequest(result.ErrorMessage);
}
-
+ ///
+ /// GET request for retrieving survey responses by survey ID.
+ ///
+
[HttpGet("SurveyResponses/{surveyId}")]
public async Task GetSurveyResponsesAsync(int surveyId)
{
@@ -42,6 +48,11 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
}
return NoContent();
}
+ ///
+ /// GET request for retrieving survey responses by survey and location IDs.
+ ///
+ /// The ID of the survey for which responses are to be retrieved.
+ /// The ID of the location for which responses are to be retrieved.
[HttpGet("Responses/{surveyId}/{locationId}")]
public async Task GetSurveyResponsesBySurveyAndLocationAsync(int surveyId, string locationId)
@@ -54,6 +65,12 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
return NoContent();
}
+ ///
+ /// GET request for retrieving survey responses by survey, question, and answer.
+ ///
+ /// The ID of the survey for which responses are to be retrieved.
+ /// The ID of the question for which responses are to be retrieved.
+ /// The answer for which responses are to be retrieved.
[HttpGet("ResponsesByAnswer/{surveyId}/{questionId}/{answer}")]
public async Task GetSurveyResponsesByAnswerAsyncAsync(int surveyId, int questionId, string answer)
@@ -66,6 +83,10 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
return NoContent();
}
+ ///
+ /// GET request for retrieving answers from survey responses by survey ID and region.
+ ///
+ /// The ID of the survey for which answers are to be retrieved.
[HttpGet("AnswersByRegion/{surveyId}")]
public async Task GetAnswersByRegionAsync(int surveyId)
@@ -77,6 +98,10 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
}
return NoContent();
}
+ ///
+ /// GET request for retrieving survey responses by survey ID and maintenance center.
+ ///
+ /// The ID of the survey for which responses are to be retrieved.
[HttpGet("AnswersByMaintenanceCenter/{surveyId}")]
public async Task GetAnswersByMaintenaceCentersync(int surveyId)
@@ -88,6 +113,10 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
}
return NoContent();
}
+ ///
+ /// GET request for retrieving a survey response by response ID.
+ ///
+ /// The ID of the survey response to be retrieved.
[HttpGet("SurveyResponse/{responseId}")]
public async Task GetSurveyResponseByIdAsync(int responseId)
@@ -100,6 +129,10 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
return NoContent();
}
+ ///
+ /// POST request for creating a new survey response.
+ ///
+ /// The survey response object to be created.
[HttpPost("SurveyResponses")]
public async Task PostSurveysAsync(Models.SurveyResponse surveyResponse)
@@ -111,6 +144,11 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
}
return BadRequest(result.ErrorMessage);
}
+ ///
+ /// PUT request for updating an existing survey response.
+ ///
+ /// The ID of the survey response to be updated.
+ /// The updated survey response object.
[HttpPut("SurveyResponses/{Id}")]
public async Task PutSurveyResponseAsync(int Id, Models.SurveyResponse surveyResponse)
@@ -125,7 +163,10 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
return BadRequest(result.ErrorMessage);
}
-
+ ///
+ /// DELETE request for deleting an existing survey response.
+ ///
+
[HttpDelete("SurveyResponses/{Id}")]
public async Task DeleteSurveyResponseAsync(int Id)
{
@@ -136,6 +177,10 @@ namespace DamageAssesment.Api.SurveyResponses.Controllers
}
return NotFound();
}
+ ///
+ /// POST request for submitting survey with multiple answers.
+ ///
+ /// The answers to be submitted for the survey.
[HttpPost("SurveyResponses/Answers")]
public async Task PostSurveyAnswersAsync(AnswerRequest answers)
diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj
index a2383fa..aae62bb 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj
+++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj
@@ -4,6 +4,7 @@
net6.0
enable
enable
+ True
diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Program.cs
index b94d753..a4f585f 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Program.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Program.cs
@@ -4,6 +4,7 @@ using DamageAssesment.Api.SurveyResponses.Providers;
using Microsoft.AspNetCore.DataProtection.XmlEncryption;
using Microsoft.EntityFrameworkCore;
using Polly;
+using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
const int maxApiCallRetries = 3;
@@ -50,7 +51,14 @@ builder.Services.AddHttpClient().
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
+//builder.Services.AddSwaggerGen();
+builder.Services.AddSwaggerGen(c =>
+{
+ // Include XML comments from your assembly
+ var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
+ c.IncludeXmlComments(xmlPath);
+});
builder.Services.AddDbContext(option =>
{
option.UseInMemoryDatabase("SurveyResponses");
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Controllers/SurveysController.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Controllers/SurveysController.cs
index 56f2e29..7644a69 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Controllers/SurveysController.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Controllers/SurveysController.cs
@@ -14,6 +14,9 @@ namespace DamageAssesment.Api.Surveys.Controllers
{
this.surveyProvider = surveyProvider;
}
+ ///
+ /// GET request for retrieving surveys.
+ ///
[HttpGet]
public async Task GetSurveysAsync()
@@ -25,6 +28,10 @@ namespace DamageAssesment.Api.Surveys.Controllers
}
return NoContent();
}
+ ///
+ /// GET request for retrieving surveys by ID.
+ ///
+
[HttpGet("{Id}")]
public async Task GetSurveysAsync(int Id)
{
@@ -35,6 +42,9 @@ namespace DamageAssesment.Api.Surveys.Controllers
}
return NotFound();
}
+ ///
+ /// POST request for creating a new survey.
+ ///
[HttpPost]
public async Task PostSurveysAsync(Models.Survey survey)
@@ -46,6 +56,10 @@ namespace DamageAssesment.Api.Surveys.Controllers
}
return BadRequest(result.ErrorMessage);
}
+ ///
+ /// PUT request for updating an existing survey (surveyId,Updated Survey data).
+ ///
+
[HttpPut("{Id}")]
public async Task PutSurveysAsync(int Id, Models.Survey survey)
@@ -60,7 +74,10 @@ namespace DamageAssesment.Api.Surveys.Controllers
return BadRequest(result.ErrorMessage);
}
-
+ ///
+ /// DELETE request for deleting a survey by ID.
+ ///
+
[HttpDelete("{Id}")]
public async Task DeleteSurveysAsync(int Id)
{
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj b/DamageAssesmentApi/DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj
index 53e8700..7f05c71 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj
+++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj
@@ -1,9 +1,10 @@
-
+
net6.0
enable
enable
+ True
diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs
index ebb638f..f59b686 100644
--- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs
+++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs
@@ -2,6 +2,7 @@ using DamageAssesment.Api.Surveys.Db;
using DamageAssesment.Api.Surveys.Interfaces;
using DamageAssesment.Api.Surveys.Providers;
using Microsoft.EntityFrameworkCore;
+using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
@@ -12,7 +13,14 @@ builder.Services.AddControllers();
builder.Services.AddScoped();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
+//builder.Services.AddSwaggerGen();
+builder.Services.AddSwaggerGen(c =>
+{
+ // Include XML comments from your assembly
+ var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
+ c.IncludeXmlComments(xmlPath);
+});
builder.Services.AddDbContext(option =>
{
option.UseInMemoryDatabase("Surveys");