forked from MDCPS/DamageAssessment_Backend
		
	Compare commits
	
		
			99 Commits
		
	
	
		
			Azure-Inte
			...
			docker-Azu
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 48af2f3623 | |||
| 4885311290 | |||
| cc9619e92e | |||
| cd982d160a | |||
| 9b88029a09 | |||
| 3b9e13ad35 | |||
| dca119758a | |||
| 8285588db9 | |||
| fc166e65c9 | |||
| ae6b306290 | |||
| 499ac9248b | |||
| 7b7e5c0ce8 | |||
| d3a751a6ad | |||
| 2182b9a6b3 | |||
| e2bed66428 | |||
| f9b7fad33b | |||
| d219faa147 | |||
| 40ab868e82 | |||
| aae073d456 | |||
| 39df8c017b | |||
| 0cc5be64ee | |||
| fa68071d64 | |||
| acb5067ce5 | |||
| f7141493ca | |||
| e8cbe76166 | |||
| afb520463a | |||
| 1f046e0c70 | |||
| 7b821decbd | |||
| f321641870 | |||
| bbe8008fc2 | |||
| 8624eeeb97 | |||
| 16d45d6632 | |||
| 8349e78f6e | |||
| c77e0452c4 | |||
| 8a803ad157 | |||
| 027097d12d | |||
| c89c6f60c3 | |||
| 08f873e8e3 | |||
| dadbcf98b9 | |||
| 7935302b2d | |||
| 55e27059e5 | |||
| 3ac36bf86f | |||
| 7985428f8b | |||
| 0dd6d3b1e3 | |||
| d3cf6a63e5 | |||
| 45109881ad | |||
| f91b935374 | |||
| 6ad5bb1572 | |||
| 8e0a7df68b | |||
| cb3c7f8f6a | |||
| 01ccd97528 | |||
| 26b360e0a9 | |||
| 360a58c026 | |||
| 26e79432e2 | |||
| 11c6fc0dc9 | |||
| 99633d8dda | |||
| 8e3f6674c6 | |||
| 885fdeb117 | |||
| 14956057cd | |||
| fa3e3bbd99 | |||
| 340ba6fa6d | |||
| 46794057c4 | |||
| 3911980842 | |||
| 71d4b524e7 | |||
| 9b91afd329 | |||
| 1510c3ab12 | |||
| c7a2dc5910 | |||
| 643bc0c76a | |||
| 15b5fba35e | |||
| 7d3968bb62 | |||
| cee61c9b87 | |||
| 2aca01c8b4 | |||
| bac2eef4fb | |||
| 6ae57c9818 | |||
| d2ae8a30a6 | |||
| 076a8004e2 | |||
| 54d6fab64f | |||
| 045a0995bb | |||
| dc1cb899d0 | |||
| 044876b23b | |||
| 30751bc491 | |||
| fa0ec795c1 | |||
| 8e31691044 | |||
| 82c768a0d9 | |||
| f5c2b2da44 | |||
| 17b4177a26 | |||
| c5f3473ccb | |||
| 8744761b00 | |||
| 7f82b10bbc | |||
| 31eeb2b63d | |||
| 49d809bbff | |||
| cddbe63464 | |||
| 7a59d300d4 | |||
| 947efebdf3 | |||
| 86f4eebe72 | |||
| fb5a69fa19 | |||
| 427fa3e559 | |||
| eab826cf09 | |||
| 3207b58b96 | 
							
								
								
									
										
											BIN
										
									
								
								.vs/Backend-API-Services/v17/.wsuo
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.vs/Backend-API-Services/v17/.wsuo
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										7
									
								
								.vs/VSWorkspaceState.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								.vs/VSWorkspaceState.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "ExpandedNodes": [
 | 
				
			||||||
 | 
					    ""
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "SelectedNode": "\\DamageAssesment.sln",
 | 
				
			||||||
 | 
					  "PreviewInSolutionExplorer": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								DamageAssesmentApi/.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								DamageAssesmentApi/.dockerignore
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					**/.classpath
 | 
				
			||||||
 | 
					**/.dockerignore
 | 
				
			||||||
 | 
					**/.env
 | 
				
			||||||
 | 
					**/.git
 | 
				
			||||||
 | 
					**/.gitignore
 | 
				
			||||||
 | 
					**/.project
 | 
				
			||||||
 | 
					**/.settings
 | 
				
			||||||
 | 
					**/.toolstarget
 | 
				
			||||||
 | 
					**/.vs
 | 
				
			||||||
 | 
					**/.vscode
 | 
				
			||||||
 | 
					**/*.*proj.user
 | 
				
			||||||
 | 
					**/*.dbmdl
 | 
				
			||||||
 | 
					**/*.jfm
 | 
				
			||||||
 | 
					**/azds.yaml
 | 
				
			||||||
 | 
					**/bin
 | 
				
			||||||
 | 
					**/charts
 | 
				
			||||||
 | 
					**/docker-compose*
 | 
				
			||||||
 | 
					**/Dockerfile*
 | 
				
			||||||
 | 
					**/node_modules
 | 
				
			||||||
 | 
					**/npm-debug.log
 | 
				
			||||||
 | 
					**/obj
 | 
				
			||||||
 | 
					**/secrets.dev.yaml
 | 
				
			||||||
 | 
					**/values.dev.yaml
 | 
				
			||||||
 | 
					LICENSE
 | 
				
			||||||
 | 
					README.md
 | 
				
			||||||
							
								
								
									
										3
									
								
								DamageAssesmentApi/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								DamageAssesmentApi/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -395,4 +395,5 @@ FodyWeavers.xsd
 | 
				
			|||||||
*.msp
 | 
					*.msp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# JetBrains Rider
 | 
					# JetBrains Rider
 | 
				
			||||||
*.sln.iml
 | 
					*.sln.iml
 | 
				
			||||||
 | 
					**/migrations/
 | 
				
			||||||
@ -16,7 +16,7 @@ namespace DamageAssesment.Api.Answers.Controllers
 | 
				
			|||||||
        /// Get all answers
 | 
					        /// Get all answers
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Answers")]
 | 
					        [HttpGet("answers")]
 | 
				
			||||||
        public async Task<ActionResult> GetAnswersAsync() {
 | 
					        public async Task<ActionResult> GetAnswersAsync() {
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
            var result = await answerProvider.GetAnswersAsync();
 | 
					            var result = await answerProvider.GetAnswersAsync();
 | 
				
			||||||
@ -32,11 +32,11 @@ namespace DamageAssesment.Api.Answers.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Answers/{Id}")]
 | 
					        [HttpGet("answers/{id}")]
 | 
				
			||||||
        public async Task<ActionResult> GetAnswerByIdAsync(int Id)
 | 
					        public async Task<ActionResult> GetAnswerByIdAsync(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var result = await answerProvider.GetAnswerByIdAsync(Id);
 | 
					            var result = await answerProvider.GetAnswerByIdAsync(id);
 | 
				
			||||||
            if (result.IsSuccess)
 | 
					            if (result.IsSuccess)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                return Ok(result.Answer);
 | 
					                return Ok(result.Answer);
 | 
				
			||||||
@ -48,7 +48,7 @@ namespace DamageAssesment.Api.Answers.Controllers
 | 
				
			|||||||
        /// Get all answers based on responseId.
 | 
					        /// Get all answers based on responseId.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Answers/ByResponse/{responseid}")]
 | 
					        [HttpGet("answers/byresponse/{responseid}")]
 | 
				
			||||||
        public async Task<IActionResult> GetAnswersByResponseId(int responseid)
 | 
					        public async Task<IActionResult> GetAnswersByResponseId(int responseid)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.answerProvider.GetAnswersAsync(responseid);
 | 
					            var result = await this.answerProvider.GetAnswersAsync(responseid);
 | 
				
			||||||
@ -62,7 +62,7 @@ namespace DamageAssesment.Api.Answers.Controllers
 | 
				
			|||||||
        /// Get all answers based on questionId.
 | 
					        /// Get all answers based on questionId.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Answers/ByQuestion/{questionid}")]
 | 
					        [HttpGet("answers/byquestion/{questionid}")]
 | 
				
			||||||
        public async Task<IActionResult> AnswersByQuestionId(int questionid)
 | 
					        public async Task<IActionResult> AnswersByQuestionId(int questionid)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.answerProvider.GetAnswersByQuestionAsync(questionid);
 | 
					            var result = await this.answerProvider.GetAnswersByQuestionAsync(questionid);
 | 
				
			||||||
@ -76,7 +76,7 @@ namespace DamageAssesment.Api.Answers.Controllers
 | 
				
			|||||||
        /// Update an existing answer.
 | 
					        /// Update an existing answer.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPut("Answers")]
 | 
					        [HttpPut("answers")]
 | 
				
			||||||
        public async Task<IActionResult> UpdateAnswer(Models.Answer answer)
 | 
					        public async Task<IActionResult> UpdateAnswer(Models.Answer answer)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (answer != null)
 | 
					            if (answer != null)
 | 
				
			||||||
@ -97,7 +97,7 @@ namespace DamageAssesment.Api.Answers.Controllers
 | 
				
			|||||||
        /// Save a new answer.
 | 
					        /// Save a new answer.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPost("Answers")]
 | 
					        [HttpPost("answers")]
 | 
				
			||||||
        public async Task<IActionResult> CreateAnswer(Models.Answer answer)
 | 
					        public async Task<IActionResult> CreateAnswer(Models.Answer answer)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (answer != null)
 | 
					            if (answer != null)
 | 
				
			||||||
@ -115,7 +115,7 @@ namespace DamageAssesment.Api.Answers.Controllers
 | 
				
			|||||||
        ///  Delete an existing answer.
 | 
					        ///  Delete an existing answer.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpDelete("Answers/{id}")]
 | 
					        [HttpDelete("answers/{id}")]
 | 
				
			||||||
        public async Task<IActionResult> DeleteAnswer(int id)
 | 
					        public async Task<IActionResult> DeleteAnswer(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.answerProvider.DeleteAnswerAsync(id);
 | 
					            var result = await this.answerProvider.DeleteAnswerAsync(id);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,12 @@
 | 
				
			|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
					<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <PropertyGroup>
 | 
					  <PropertyGroup>
 | 
				
			||||||
    <TargetFramework>net6.0</TargetFramework>
 | 
					    <TargetFramework>net6.0</TargetFramework>
 | 
				
			||||||
    <Nullable>enable</Nullable>
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
					    <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
					    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
				
			||||||
 | 
					    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
 | 
				
			||||||
 | 
					    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
@ -17,6 +19,7 @@
 | 
				
			|||||||
    </PackageReference>
 | 
					    </PackageReference>
 | 
				
			||||||
    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
 | 
					    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
 | 
				
			||||||
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
 | 
					    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
 | 
				
			||||||
 | 
					    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
 | 
				
			||||||
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
					    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Answers.Db
 | 
					namespace DamageAssesment.Api.Answers.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("Answers")]
 | 
				
			||||||
    public class Answer
 | 
					    public class Answer
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										21
									
								
								DamageAssesmentApi/DamageAssesment.Api.Answers/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								DamageAssesmentApi/DamageAssesment.Api.Answers/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					EXPOSE 80
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 | 
				
			||||||
 | 
					WORKDIR /src
 | 
				
			||||||
 | 
					COPY ["DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj", "DamageAssesment.Api.Answers/"]
 | 
				
			||||||
 | 
					RUN dotnet restore "DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj"
 | 
				
			||||||
 | 
					COPY . .
 | 
				
			||||||
 | 
					WORKDIR "/src/DamageAssesment.Api.Answers"
 | 
				
			||||||
 | 
					RUN dotnet build "DamageAssesment.Api.Answers.csproj" -c Release -o /app/build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM build AS publish
 | 
				
			||||||
 | 
					RUN dotnet publish "DamageAssesment.Api.Answers.csproj" -c Release -o /app/publish /p:UseAppHost=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM base AS final
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					COPY --from=publish /app/publish .
 | 
				
			||||||
 | 
					ENTRYPOINT ["dotnet", "DamageAssesment.Api.Answers.dll"]
 | 
				
			||||||
@ -1,58 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Answers.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Answers.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(AnswerDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230816214724_InitialCreate")]
 | 
					 | 
				
			||||||
    partial class InitialCreate
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Answers.Db.Answer", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("AnswerText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(250)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(250)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Comment")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int?>("SurveyResponseId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Answers");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,37 +0,0 @@
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Answers.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class InitialCreate : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "Answers",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    QuestionId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    AnswerText = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
 | 
					 | 
				
			||||||
                    Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    SurveyResponseId = table.Column<int>(type: "int", nullable: true)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_Answers", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "Answers");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,58 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Answers.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Answers.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(AnswerDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230927172606_InitialAnswer")]
 | 
					 | 
				
			||||||
    partial class InitialAnswer
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Answers.Db.Answer", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("AnswerText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(250)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(250)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Comment")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int?>("SurveyResponseId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Answers");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,22 +0,0 @@
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Answers.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class InitialAnswer : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,58 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Answers.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Answers.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(AnswerDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230927173358_InitialAnswercreate")]
 | 
					 | 
				
			||||||
    partial class InitialAnswercreate
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Answers.Db.Answer", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("AnswerText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(250)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(250)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Comment")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int?>("SurveyResponseId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Answers");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,22 +0,0 @@
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Answers.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class InitialAnswercreate : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,55 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Answers.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Answers.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(AnswerDbContext))]
 | 
					 | 
				
			||||||
    partial class AnswerDbContextModelSnapshot : ModelSnapshot
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        protected override void BuildModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Answers.Db.Answer", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("AnswerText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(250)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(250)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Comment")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int?>("SurveyResponseId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Answers");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,23 +1,14 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
					 | 
				
			||||||
  "iisSettings": {
 | 
					 | 
				
			||||||
    "windowsAuthentication": false,
 | 
					 | 
				
			||||||
    "anonymousAuthentication": true,
 | 
					 | 
				
			||||||
    "iisExpress": {
 | 
					 | 
				
			||||||
      "applicationUrl": "http://localhost:18005",
 | 
					 | 
				
			||||||
      "sslPort": 0
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "profiles": {
 | 
					  "profiles": {
 | 
				
			||||||
    "DamageAssesment.Api.Answers": {
 | 
					    "DamageAssesment.Api.Answers": {
 | 
				
			||||||
      "commandName": "Project",
 | 
					      "commandName": "Project",
 | 
				
			||||||
      "dotnetRunMessages": true,
 | 
					 | 
				
			||||||
      "launchBrowser": true,
 | 
					      "launchBrowser": true,
 | 
				
			||||||
      "launchUrl": "swagger",
 | 
					      "launchUrl": "swagger",
 | 
				
			||||||
      "applicationUrl": "http://localhost:5200",
 | 
					 | 
				
			||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      },
 | 
				
			||||||
 | 
					      "dotnetRunMessages": true,
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:5200"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "IIS Express": {
 | 
					    "IIS Express": {
 | 
				
			||||||
      "commandName": "IISExpress",
 | 
					      "commandName": "IISExpress",
 | 
				
			||||||
@ -26,6 +17,24 @@
 | 
				
			|||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "Docker": {
 | 
				
			||||||
 | 
					      "commandName": "Docker",
 | 
				
			||||||
 | 
					      "launchBrowser": true,
 | 
				
			||||||
 | 
					      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
 | 
				
			||||||
 | 
					      "environmentVariables": {
 | 
				
			||||||
 | 
					        "ASPNETCORE_URLS": "http://+:80"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "publishAllPorts": true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
				
			||||||
 | 
					  "iisSettings": {
 | 
				
			||||||
 | 
					    "windowsAuthentication": false,
 | 
				
			||||||
 | 
					    "anonymousAuthentication": true,
 | 
				
			||||||
 | 
					    "iisExpress": {
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:18005",
 | 
				
			||||||
 | 
					      "sslPort": 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -8,19 +8,20 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    public class AnswersProvider : IAnswersProvider
 | 
					    public class AnswersProvider : IAnswersProvider
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        private AnswerDbContext answerDbContext;
 | 
					        private AnswerDbContext answerDbContext;
 | 
				
			||||||
        private ILogger<AnswersProvider> logger;
 | 
					        private ILogger<AnswersProvider> logger;
 | 
				
			||||||
        private IMapper mapper;
 | 
					        private IMapper mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Constructor with dependency injection and data seeding
 | 
				
			||||||
        public AnswersProvider(AnswerDbContext answerDbContext, ILogger<AnswersProvider> logger, IMapper mapper)
 | 
					        public AnswersProvider(AnswerDbContext answerDbContext, ILogger<AnswersProvider> logger, IMapper mapper)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            this.answerDbContext = answerDbContext;
 | 
					            this.answerDbContext = answerDbContext;
 | 
				
			||||||
            this.logger = logger;
 | 
					            this.logger = logger;
 | 
				
			||||||
            this.mapper = mapper;
 | 
					            this.mapper = mapper;
 | 
				
			||||||
            SeedData();
 | 
					            SeedData(); // Seed initial data if the table is empty
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Get all answers
 | 
				
			||||||
        public async Task<(bool IsSuccess, IEnumerable<Models.Answer> Answers, string ErrorMessage)> GetAnswersAsync()
 | 
					        public async Task<(bool IsSuccess, IEnumerable<Models.Answer> Answers, string ErrorMessage)> GetAnswersAsync()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
@ -40,9 +41,9 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
                logger?.LogError(ex.ToString());
 | 
					                logger?.LogError(ex.ToString());
 | 
				
			||||||
                return (false, null, ex.Message);
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Get an answer by its ID
 | 
				
			||||||
        public async Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> GetAnswerByIdAsync(int Id)
 | 
					        public async Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> GetAnswerByIdAsync(int Id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
@ -63,6 +64,8 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
                return (false, null, ex.Message);
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Get answers by survey response ID
 | 
				
			||||||
        public async Task<(bool IsSuccess, IEnumerable<Models.Answer> Answers, string ErrorMessage)> GetAnswersAsync(int surveyResponseId)
 | 
					        public async Task<(bool IsSuccess, IEnumerable<Models.Answer> Answers, string ErrorMessage)> GetAnswersAsync(int surveyResponseId)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
@ -74,17 +77,17 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    var result = mapper.Map<IEnumerable<Db.Answer>, IEnumerable<Models.Answer>>(respAnswers);
 | 
					                    var result = mapper.Map<IEnumerable<Db.Answer>, IEnumerable<Models.Answer>>(respAnswers);
 | 
				
			||||||
                    return (true, result, null);
 | 
					                    return (true, result, null);
 | 
				
			||||||
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return (false, null, "Not Found");
 | 
					                return (false, null, "Not Found");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                logger?.LogError(ex.ToString());
 | 
					                logger?.LogError(ex.ToString());
 | 
				
			||||||
                return (false, null, ex.Message);
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Get answers by question ID
 | 
				
			||||||
        public async Task<(bool IsSuccess, IEnumerable<Models.Answer> Answers, string ErrorMessage)> GetAnswersByQuestionAsync(int questionId)
 | 
					        public async Task<(bool IsSuccess, IEnumerable<Models.Answer> Answers, string ErrorMessage)> GetAnswersByQuestionAsync(int questionId)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
@ -96,17 +99,17 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    var result = mapper.Map<IEnumerable<Db.Answer>, IEnumerable<Models.Answer>>(respAnswers);
 | 
					                    var result = mapper.Map<IEnumerable<Db.Answer>, IEnumerable<Models.Answer>>(respAnswers);
 | 
				
			||||||
                    return (true, result, null);
 | 
					                    return (true, result, null);
 | 
				
			||||||
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return (false, null, "Not Found");
 | 
					                return (false, null, "Not Found");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                logger?.LogError(ex.ToString());
 | 
					                logger?.LogError(ex.ToString());
 | 
				
			||||||
                return (false, null, ex.Message);
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Create a new answer
 | 
				
			||||||
        public async Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> PostAnswerAsync(Models.Answer Answer)
 | 
					        public async Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> PostAnswerAsync(Models.Answer Answer)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
@ -120,7 +123,7 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
                    var result = mapper.Map<Db.Answer, Models.Answer>(answer);
 | 
					                    var result = mapper.Map<Db.Answer, Models.Answer>(answer);
 | 
				
			||||||
                    return (true, result, null);
 | 
					                    return (true, result, null);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return (false, null, "Answer is already exits");
 | 
					                return (false, null, "Answer is already exists");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@ -128,6 +131,8 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
                return (false, null, ex.Message);
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Update an existing answer
 | 
				
			||||||
        public async Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> UpdateAnswerAsync(Models.Answer Answer)
 | 
					        public async Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> UpdateAnswerAsync(Models.Answer Answer)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
@ -156,14 +161,14 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                logger?.LogError(ex.ToString());
 | 
					                logger?.LogError(ex.ToString());
 | 
				
			||||||
                return (false,null, ex.Message);
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Delete an answer by its ID
 | 
				
			||||||
        public async Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> DeleteAnswerAsync(int Id)
 | 
					        public async Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> DeleteAnswerAsync(int Id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Db.Answer answer = answerDbContext.Answers.AsNoTracking().Where(a => a.Id == Id).FirstOrDefault();
 | 
					                Db.Answer answer = answerDbContext.Answers.AsNoTracking().Where(a => a.Id == Id).FirstOrDefault();
 | 
				
			||||||
@ -173,30 +178,32 @@ namespace DamageAssesment.Api.Answers.Providers
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                answerDbContext.Answers.Remove(answer);
 | 
					                answerDbContext.Answers.Remove(answer);
 | 
				
			||||||
                answerDbContext.SaveChanges();
 | 
					                answerDbContext.SaveChanges();
 | 
				
			||||||
                return (true, mapper.Map<Db.Answer, Models.Answer>(answer), $"AnswerId {Id} deleted Successfuly");
 | 
					                return (true, mapper.Map<Db.Answer, Models.Answer>(answer), $"AnswerId {Id} deleted successfully");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                logger?.LogError(ex.ToString());
 | 
					                logger?.LogError(ex.ToString());
 | 
				
			||||||
                return (false,null, ex.Message);
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Check if an answer with a specific ID exists
 | 
				
			||||||
        private bool AnswerExists(int id)
 | 
					        private bool AnswerExists(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return answerDbContext.Answers.AsNoTracking().Count(e => e.Id == id) > 0;
 | 
					            return answerDbContext.Answers.AsNoTracking().Count(e => e.Id == id) > 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Seed initial data if the table is empty
 | 
				
			||||||
        public void SeedData()
 | 
					        public void SeedData()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (!answerDbContext.Answers.Any())
 | 
					            if (!answerDbContext.Answers.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "Yes", Comment = "", QuestionId = 1, SurveyResponseId = 1 });
 | 
					                answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "Yes", Comment = "", QuestionId = 1, SurveyResponseId = 1 });
 | 
				
			||||||
                answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "Yes", Comment = "myComment", QuestionId = 2, SurveyResponseId = 1 });
 | 
					                answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "No", Comment = "myComment", QuestionId = 2, SurveyResponseId = 1 });
 | 
				
			||||||
                answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "No", Comment = "No Comment", QuestionId = 3, SurveyResponseId = 1 });
 | 
					                //answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "No", Comment = "No Comment", QuestionId = 3, SurveyResponseId = 1 });
 | 
				
			||||||
                answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "Yes", Comment = "No Comment", QuestionId = 1, SurveyResponseId = 2 });
 | 
					                //answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "Yes", Comment = "No Comment", QuestionId = 1, SurveyResponseId = 2 });
 | 
				
			||||||
                answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "No", Comment = "No Comment", QuestionId = 2, SurveyResponseId = 2 });
 | 
					                //answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "No", Comment = "No Comment", QuestionId = 2, SurveyResponseId = 2 });
 | 
				
			||||||
                answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "No", Comment = "No Comment", QuestionId = 3, SurveyResponseId = 2 });
 | 
					                //answerDbContext.Answers.Add(new Db.Answer() {  AnswerText = "No", Comment = "No Comment", QuestionId = 3, SurveyResponseId = 2 });
 | 
				
			||||||
                answerDbContext.SaveChanges();
 | 
					                answerDbContext.SaveChanges();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "Logging": {
 | 
					 | 
				
			||||||
    "LogLevel": {
 | 
					 | 
				
			||||||
      "Default": "Information",
 | 
					 | 
				
			||||||
      "Microsoft.AspNetCore": "Warning"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -9,10 +9,8 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "AllowedHosts": "*",
 | 
					  "AllowedHosts": "*",
 | 
				
			||||||
  //"ConnectionStrings": {
 | 
					 | 
				
			||||||
  //  "AnswerConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
					 | 
				
			||||||
  //},
 | 
					 | 
				
			||||||
  "ConnectionStrings": {
 | 
					  "ConnectionStrings": {
 | 
				
			||||||
 | 
					    //"AnswerConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
				
			||||||
    "AnswerConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
					    "AnswerConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@ namespace DamageAssesment.Api.Attachments.Controllers
 | 
				
			|||||||
        /// Get all attachments.
 | 
					        /// Get all attachments.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Attachments")]
 | 
					        [HttpGet("attachments")]
 | 
				
			||||||
        public async Task<ActionResult> GetAttachmentsAsync()
 | 
					        public async Task<ActionResult> GetAttachmentsAsync()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -40,7 +40,7 @@ namespace DamageAssesment.Api.Attachments.Controllers
 | 
				
			|||||||
        /// Get all attachments by attachmentId.
 | 
					        /// Get all attachments by attachmentId.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Attachments/{id}")]
 | 
					        [HttpGet("attachments/{id}")]
 | 
				
			||||||
        public async Task<ActionResult> GetAttachmentbyIdAsync(int id)
 | 
					        public async Task<ActionResult> GetAttachmentbyIdAsync(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -84,7 +84,7 @@ namespace DamageAssesment.Api.Attachments.Controllers
 | 
				
			|||||||
        /// Save new Attachment(s)
 | 
					        /// Save new Attachment(s)
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPost("Attachments"), DisableRequestSizeLimit]
 | 
					        [HttpPost("attachments"), DisableRequestSizeLimit]
 | 
				
			||||||
        public async Task<IActionResult> UploadAttachmentAsync(AttachmentInfo attachmentInfo)
 | 
					        public async Task<IActionResult> UploadAttachmentAsync(AttachmentInfo attachmentInfo)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
@ -111,7 +111,7 @@ namespace DamageAssesment.Api.Attachments.Controllers
 | 
				
			|||||||
        /// Modify an new attachment.
 | 
					        /// Modify an new attachment.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPut("Attachments"), DisableRequestSizeLimit]
 | 
					        [HttpPut("attachments"), DisableRequestSizeLimit]
 | 
				
			||||||
        public async Task<IActionResult> UpdateAttachmentAsync(AttachmentInfo attachmentInfo)
 | 
					        public async Task<IActionResult> UpdateAttachmentAsync(AttachmentInfo attachmentInfo)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
@ -142,7 +142,7 @@ namespace DamageAssesment.Api.Attachments.Controllers
 | 
				
			|||||||
        /// Delete an existing attachment.
 | 
					        /// Delete an existing attachment.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpDelete("Attachments/{id}")]
 | 
					        [HttpDelete("attachments/{id}")]
 | 
				
			||||||
        public async Task<IActionResult> DeleteAttachment(int id)
 | 
					        public async Task<IActionResult> DeleteAttachment(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // database soft delete
 | 
					            // database soft delete
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,8 @@
 | 
				
			|||||||
    <Nullable>enable</Nullable>
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
					    <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
					    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
				
			||||||
 | 
					    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
 | 
				
			||||||
 | 
					    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
@ -25,6 +27,7 @@
 | 
				
			|||||||
      <PrivateAssets>all</PrivateAssets>
 | 
					      <PrivateAssets>all</PrivateAssets>
 | 
				
			||||||
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
 | 
					      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
 | 
				
			||||||
    </PackageReference>
 | 
					    </PackageReference>
 | 
				
			||||||
 | 
					    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
 | 
				
			||||||
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
					    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Attachments.Db
 | 
					namespace DamageAssesment.Api.Attachments.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("AnswerAttachments")]
 | 
				
			||||||
    public class Attachment
 | 
					    public class Attachment
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					EXPOSE 80
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 | 
				
			||||||
 | 
					WORKDIR /src
 | 
				
			||||||
 | 
					COPY ["DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj", "DamageAssesment.Api.Attachments/"]
 | 
				
			||||||
 | 
					RUN dotnet restore "DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj"
 | 
				
			||||||
 | 
					COPY . .
 | 
				
			||||||
 | 
					WORKDIR "/src/DamageAssesment.Api.Attachments"
 | 
				
			||||||
 | 
					RUN dotnet build "DamageAssesment.Api.Attachments.csproj" -c Release -o /app/build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM build AS publish
 | 
				
			||||||
 | 
					RUN dotnet publish "DamageAssesment.Api.Attachments.csproj" -c Release -o /app/publish /p:UseAppHost=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM base AS final
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					COPY --from=publish /app/publish .
 | 
				
			||||||
 | 
					# Create directories for attachments and set permissions
 | 
				
			||||||
 | 
					RUN mkdir -p /app/DMS_Attachments/Active && \
 | 
				
			||||||
 | 
					    mkdir -p /app/DMS_Attachments/Deleted && \
 | 
				
			||||||
 | 
					    chown -R www-data:www-data /app/DMS_Attachments
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Update appsettings.json with the correct paths for attachments
 | 
				
			||||||
 | 
					RUN sed -i 's#"folderpath": "DMS_Attachments/Active"#"folderpath": "/app/DMS_Attachments/Active"#' appsettings.json && \
 | 
				
			||||||
 | 
					    sed -i 's#"Deletepath": "DMS_Attachments/Deleted"#"Deletepath": "/app/DMS_Attachments/Deleted"#' appsettings.json
 | 
				
			||||||
 | 
					ENTRYPOINT ["dotnet", "DamageAssesment.Api.Attachments.dll"]
 | 
				
			||||||
@ -1,60 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Attachments.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Attachments.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(AttachmentsDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230817212256_InitialAttachment")]
 | 
					 | 
				
			||||||
    partial class InitialAttachment
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Attachments.Db.Attachment", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int?>("AnswerId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("FileName")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsDeleted")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("ResponseId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("URI")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Attachments");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,38 +0,0 @@
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Attachments.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class InitialAttachment : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "Attachments",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    URI = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    AnswerId = table.Column<int>(type: "int", nullable: true),
 | 
					 | 
				
			||||||
                    ResponseId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
 | 
					 | 
				
			||||||
                    FileName = table.Column<string>(type: "nvarchar(max)", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_Attachments", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "Attachments");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,57 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Attachments.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Attachments.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(AttachmentsDbContext))]
 | 
					 | 
				
			||||||
    partial class AttachmentsDbContextModelSnapshot : ModelSnapshot
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        protected override void BuildModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Attachments.Db.Attachment", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int?>("AnswerId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("FileName")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsDeleted")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("ResponseId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("URI")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Attachments");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,23 +1,14 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
					 | 
				
			||||||
  "iisSettings": {
 | 
					 | 
				
			||||||
    "windowsAuthentication": false,
 | 
					 | 
				
			||||||
    "anonymousAuthentication": true,
 | 
					 | 
				
			||||||
    "iisExpress": {
 | 
					 | 
				
			||||||
      "applicationUrl": "http://localhost:65305",
 | 
					 | 
				
			||||||
      "sslPort": 0
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "profiles": {
 | 
					  "profiles": {
 | 
				
			||||||
    "DamageAssesment.Api.Attachments": {
 | 
					    "DamageAssesment.Api.Attachments": {
 | 
				
			||||||
      "commandName": "Project",
 | 
					      "commandName": "Project",
 | 
				
			||||||
      "dotnetRunMessages": true,
 | 
					 | 
				
			||||||
      "launchBrowser": true,
 | 
					      "launchBrowser": true,
 | 
				
			||||||
      "launchUrl": "swagger",
 | 
					      "launchUrl": "swagger",
 | 
				
			||||||
      "applicationUrl": "http://localhost:5243",
 | 
					 | 
				
			||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      },
 | 
				
			||||||
 | 
					      "dotnetRunMessages": true,
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:5243"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "IIS Express": {
 | 
					    "IIS Express": {
 | 
				
			||||||
      "commandName": "IISExpress",
 | 
					      "commandName": "IISExpress",
 | 
				
			||||||
@ -26,6 +17,24 @@
 | 
				
			|||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "Docker": {
 | 
				
			||||||
 | 
					      "commandName": "Docker",
 | 
				
			||||||
 | 
					      "launchBrowser": true,
 | 
				
			||||||
 | 
					      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
 | 
				
			||||||
 | 
					      "environmentVariables": {
 | 
				
			||||||
 | 
					        "ASPNETCORE_URLS": "http://+:80"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "publishAllPorts": true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
				
			||||||
 | 
					  "iisSettings": {
 | 
				
			||||||
 | 
					    "windowsAuthentication": false,
 | 
				
			||||||
 | 
					    "anonymousAuthentication": true,
 | 
				
			||||||
 | 
					    "iisExpress": {
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:65305",
 | 
				
			||||||
 | 
					      "sslPort": 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "Logging": {
 | 
					 | 
				
			||||||
    "LogLevel": {
 | 
					 | 
				
			||||||
      "Default": "Information",
 | 
					 | 
				
			||||||
      "Microsoft.AspNetCore": "Warning"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -15,11 +15,10 @@
 | 
				
			|||||||
    "BlobConnectionString": "DefaultEndpointsProtocol=https;AccountName=damagedoculink;AccountKey=blynpwrAQtthEneXC5f4vFewJ3tPV+QZUt1AX3nefZScPPjkr5hMoC18B9ni6/ZYdhRiERPQw+hB+AStonf+iw==;EndpointSuffix=core.windows.net",
 | 
					    "BlobConnectionString": "DefaultEndpointsProtocol=https;AccountName=damagedoculink;AccountKey=blynpwrAQtthEneXC5f4vFewJ3tPV+QZUt1AX3nefZScPPjkr5hMoC18B9ni6/ZYdhRiERPQw+hB+AStonf+iw==;EndpointSuffix=core.windows.net",
 | 
				
			||||||
    "BlobContainerName": "doculinks"
 | 
					    "BlobContainerName": "doculinks"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  //"ConnectionStrings": {
 | 
					 | 
				
			||||||
  //  "AttachmentConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
					 | 
				
			||||||
  //}
 | 
					 | 
				
			||||||
  "ConnectionStrings": {
 | 
					  "ConnectionStrings": {
 | 
				
			||||||
 | 
					    //"AttachmentConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
				
			||||||
    "AttachmentConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
					    "AttachmentConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
					<Project Sdk="Microsoft.NET.Sdk">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <PropertyGroup>
 | 
					  <PropertyGroup>
 | 
				
			||||||
    <TargetFramework>net6.0</TargetFramework>
 | 
					    <TargetFramework>net6.0</TargetFramework>
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
					            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
				
			||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await MockData.getNoContentResponse();
 | 
					            var mockResponse = await MockData.getNoContentResponse();
 | 
				
			||||||
            mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms","en",null)).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms", "en", null)).ReturnsAsync(mockResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (NoContentResult)await DocumentProvider.GetDocumentsAsync("", "", null);
 | 
					            var result = (NoContentResult)await DocumentProvider.GetDocumentsAsync("", "", null);
 | 
				
			||||||
@ -43,11 +43,11 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
					            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
				
			||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await MockData.getOkResponse();
 | 
					            var mockResponse = await MockData.getOkResponses();
 | 
				
			||||||
            mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms","en", null)).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms", "en", null)).ReturnsAsync(mockResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (OkObjectResult)await DocumentProvider.GetDocumentsAsync("forms","en", null);
 | 
					            var result = (OkObjectResult)await DocumentProvider.GetDocumentsAsync("forms", "en", null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Assert.Equal(200, result.StatusCode);
 | 
					            Assert.Equal(200, result.StatusCode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -56,7 +56,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
					            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
				
			||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await MockData.getOkResponse();
 | 
					            var mockResponse = await MockData.getOkResponses();
 | 
				
			||||||
            mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms", "en", true)).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms", "en", true)).ReturnsAsync(mockResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
@ -65,13 +65,39 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
            Assert.Equal(200, result.StatusCode);
 | 
					            Assert.Equal(200, result.StatusCode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact(DisplayName = "Get active Documents by linktypeid - Ok case")]
 | 
				
			||||||
 | 
					        public async Task GetActiveDocumentsLinkTypeIdAsync_ShouldReturnStatusCode200()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
				
			||||||
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
 | 
					            var mockResponse = await MockData.getOkResponses();
 | 
				
			||||||
 | 
					            mockDocumentService.Setup(service => service.GetdocumentsByLinkTypeIdAsync(null, "en", true)).ReturnsAsync(mockResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
 | 
					            var result = (OkObjectResult)await DocumentProvider.GetDocumentsByActiveLinkTypeIdAsync(null, "en");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Assert.Equal(200, result.StatusCode);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        [Fact(DisplayName = "Get active Documents by linktypeid  - NoContent Case")]
 | 
				
			||||||
 | 
					        public async Task GetDocumentsLinkTypeIdAsync_ShouldReturnStatusCode204()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
				
			||||||
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
 | 
					            var mockResponse = await MockData.getNoContentResponse();
 | 
				
			||||||
 | 
					            mockDocumentService.Setup(service => service.GetdocumentsByLinkTypeIdAsync(null, "en", true)).ReturnsAsync(mockResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
 | 
					            var result = (NoContentResult)await DocumentProvider.GetDocumentsByActiveLinkTypeIdAsync(null, "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Assert.Equal(204, result.StatusCode);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        [Fact(DisplayName = "Get Document by Id - Ok case")]
 | 
					        [Fact(DisplayName = "Get Document by Id - Ok case")]
 | 
				
			||||||
        public async Task GetDocumentAsync_ShouldReturnStatusCode200()
 | 
					        public async Task GetDocumentAsync_ShouldReturnStatusCode200()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
					            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
				
			||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await MockData.getOkResponse(1);
 | 
					            var mockResponse = await MockData.getOkResponse(1);
 | 
				
			||||||
            mockDocumentService.Setup(service => service.GetDocumentAsync(1,"forms","en")).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.GetDocumentAsync(1, "forms", "en")).ReturnsAsync(mockResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (OkObjectResult)await DocumentProvider.GetDocumentAsync(1, "forms", "en");
 | 
					            var result = (OkObjectResult)await DocumentProvider.GetDocumentAsync(1, "forms", "en");
 | 
				
			||||||
@ -128,9 +154,9 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
            var mockResponse = await MockData.getOkResponse(1);
 | 
					            var mockResponse = await MockData.getOkResponse(1);
 | 
				
			||||||
            var mockInputDocument = await MockData.getInputDocumentData();
 | 
					            var mockInputDocument = await MockData.getInputDocumentData();
 | 
				
			||||||
            var DocumentResponse = await MockData.GetDocuLinksInfo(1);
 | 
					            var DocumentResponse = await MockData.GetDocuLinksInfo(1);
 | 
				
			||||||
            mockDocumentService.Setup(service => service.UpdateDocumentAsync(1,mockInputDocument)).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.UpdateDocumentAsync(1, mockInputDocument)).ReturnsAsync(mockResponse);
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (NotFoundResult)await DocumentProvider.UpdateDocument(1,DocumentResponse);
 | 
					            var result = (NotFoundResult)await DocumentProvider.UpdateDocument(1, DocumentResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Assert.Equal(404, result.StatusCode);
 | 
					            Assert.Equal(404, result.StatusCode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -142,9 +168,9 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await MockData.getBadRequestResponse();
 | 
					            var mockResponse = await MockData.getBadRequestResponse();
 | 
				
			||||||
            var mockInputDocument = await MockData.getInputDocumentData();
 | 
					            var mockInputDocument = await MockData.getInputDocumentData();
 | 
				
			||||||
            mockDocumentService.Setup(service => service.UpdateDocumentAsync(99,mockInputDocument)).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.UpdateDocumentAsync(99, mockInputDocument)).ReturnsAsync(mockResponse);
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (BadRequestObjectResult)await DocumentProvider.UpdateDocument(99,null);
 | 
					            var result = (BadRequestObjectResult)await DocumentProvider.UpdateDocument(99, null);
 | 
				
			||||||
            Assert.Equal(400, result.StatusCode);
 | 
					            Assert.Equal(400, result.StatusCode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -209,7 +235,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
					            var mockDocumentService = new Mock<IDoculinkProvider>();
 | 
				
			||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await LinkTypeMockData.getOkResponse(1);
 | 
					            var mockResponse = await LinkTypeMockData.getOkResponse(1);
 | 
				
			||||||
            mockDocumentService.Setup(service => service.GetLinkTypeAsync(1,"en")).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.GetLinkTypeAsync(1, "en")).ReturnsAsync(mockResponse);
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (OkObjectResult)await DocumentProvider.GetLinkTypeAsync(1, "en");
 | 
					            var result = (OkObjectResult)await DocumentProvider.GetLinkTypeAsync(1, "en");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -264,9 +290,9 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await LinkTypeMockData.getOkResponse(1);
 | 
					            var mockResponse = await LinkTypeMockData.getOkResponse(1);
 | 
				
			||||||
            var mockInputDocument = await LinkTypeMockData.getInputLinkData(1);
 | 
					            var mockInputDocument = await LinkTypeMockData.getInputLinkData(1);
 | 
				
			||||||
            mockDocumentService.Setup(service => service.UpdateLinkTypeAsync(1,mockInputDocument)).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.UpdateLinkTypeAsync(1, mockInputDocument)).ReturnsAsync(mockResponse);
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (OkObjectResult)await DocumentProvider.UpdateLinkType(1,mockInputDocument);
 | 
					            var result = (OkObjectResult)await DocumentProvider.UpdateLinkType(1, mockInputDocument);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Assert.Equal(200, result.StatusCode);
 | 
					            Assert.Equal(200, result.StatusCode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -278,9 +304,9 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await LinkTypeMockData.getNotFoundResponse();
 | 
					            var mockResponse = await LinkTypeMockData.getNotFoundResponse();
 | 
				
			||||||
            var mockInputDocument = await LinkTypeMockData.getInputLinkData(99);
 | 
					            var mockInputDocument = await LinkTypeMockData.getInputLinkData(99);
 | 
				
			||||||
            mockDocumentService.Setup(service => service.UpdateLinkTypeAsync(99,mockInputDocument)).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.UpdateLinkTypeAsync(99, mockInputDocument)).ReturnsAsync(mockResponse);
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (NotFoundObjectResult)await DocumentProvider.UpdateLinkType(99,mockInputDocument);
 | 
					            var result = (NotFoundObjectResult)await DocumentProvider.UpdateLinkType(99, mockInputDocument);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Assert.Equal(404, result.StatusCode);
 | 
					            Assert.Equal(404, result.StatusCode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -292,7 +318,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
            var mockUploadService = new Mock<IAzureBlobService>();
 | 
					            var mockUploadService = new Mock<IAzureBlobService>();
 | 
				
			||||||
            var mockResponse = await LinkTypeMockData.getBadRequestResponse();
 | 
					            var mockResponse = await LinkTypeMockData.getBadRequestResponse();
 | 
				
			||||||
            var mockInputDocument = await LinkTypeMockData.getInputLinkData(1);
 | 
					            var mockInputDocument = await LinkTypeMockData.getInputLinkData(1);
 | 
				
			||||||
            mockDocumentService.Setup(service => service.UpdateLinkTypeAsync(1,mockInputDocument)).ReturnsAsync(mockResponse);
 | 
					            mockDocumentService.Setup(service => service.UpdateLinkTypeAsync(1, mockInputDocument)).ReturnsAsync(mockResponse);
 | 
				
			||||||
            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
					            var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
 | 
				
			||||||
            var result = (BadRequestObjectResult)await DocumentProvider.UpdateLinkType(1, mockInputDocument);
 | 
					            var result = (BadRequestObjectResult)await DocumentProvider.UpdateLinkType(1, mockInputDocument);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -11,28 +11,31 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
    public class MockData
 | 
					    public class MockData
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static async Task<(bool, List<DocuLinks.Models.ResDoculink>, string)> getOkResponse()
 | 
					        public static async Task<(bool, List<DocuLinks.Models.ResDoculink>, string)> getOkResponses()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            List<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
 | 
					            List<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
 | 
				
			||||||
            
 | 
					
 | 
				
			||||||
            for (int i = 1; i < 4; i++)
 | 
					            for (int i = 1; i < 4; i++)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Dictionary<string, string> dicttitle = new Dictionary<string, string>();
 | 
					                Dictionary<string, string> dicttitle = new Dictionary<string, string>();
 | 
				
			||||||
                Dictionary<string, string> dictdesc = new Dictionary<string, string>(); 
 | 
					                Dictionary<string, string> dictdesc = new Dictionary<string, string>();
 | 
				
			||||||
                dicttitle.Add("en", "test"); dicttitle.Add("fr", "tester");
 | 
					                dicttitle.Add("en", "test"); dicttitle.Add("fr", "tester");
 | 
				
			||||||
                dictdesc.Add("en", "test"); dictdesc.Add("fr", "tester"); 
 | 
					                dictdesc.Add("en", "test"); dictdesc.Add("fr", "tester");
 | 
				
			||||||
                List<DoculinkTranslation> DocuLinksTranslations = new List<DoculinkTranslation>();
 | 
					                List<DoculinkTranslation> DocuLinksTranslations = new List<DoculinkTranslation>();
 | 
				
			||||||
                DocuLinksTranslations.Add(new DoculinkTranslation()
 | 
					                DocuLinksTranslations.Add(new DoculinkTranslation()
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Language = "en",
 | 
					                    Language = "en",
 | 
				
			||||||
                    title = "tel"+i,
 | 
					                    title = "tel" + i,
 | 
				
			||||||
                    description = "Sample"+i
 | 
					                    description = "Sample" + i
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                List<DoculinkAttachments> doclinksAttachments = new List<DoculinkAttachments>();
 | 
					                List<DoculinkAttachments> doclinksAttachments = new List<DoculinkAttachments>();
 | 
				
			||||||
                doclinksAttachments.Add(new DoculinkAttachments()
 | 
					                doclinksAttachments.Add(new DoculinkAttachments()
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    docName = "",Path="www.google.com",
 | 
					                    docName = "",
 | 
				
			||||||
                    IsAttachments=false,CustomOrder=1
 | 
					                    Path = "www.google.com",
 | 
				
			||||||
 | 
					                    IsAttachments = false,
 | 
				
			||||||
 | 
					                    Language = "en",
 | 
				
			||||||
 | 
					                    CustomOrder = 1
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                list.Add(new DocuLinks.Models.ResDoculink()
 | 
					                list.Add(new DocuLinks.Models.ResDoculink()
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@ -40,10 +43,52 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
                    Id = i,
 | 
					                    Id = i,
 | 
				
			||||||
                    linkTypeId = i,
 | 
					                    linkTypeId = i,
 | 
				
			||||||
                    IsActive = true,
 | 
					                    IsActive = true,
 | 
				
			||||||
                    titles= dicttitle,
 | 
					                    titles = dicttitle,
 | 
				
			||||||
                    description=dictdesc,
 | 
					                    description = dictdesc,
 | 
				
			||||||
                    CustomOrder=i,
 | 
					                    CustomOrder = i,
 | 
				
			||||||
                    doclinksAttachments= doclinksAttachments
 | 
					                    doclinksAttachments = doclinksAttachments
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					           // List<ResDoculinks> doculinks = list.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
 | 
				
			||||||
 | 
					            return (true, list, null);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static async Task<(bool, List<DocuLinks.Models.ResDoculink>, string)> getOkResponse()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            List<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for (int i = 1; i < 4; i++)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Dictionary<string, string> dicttitle = new Dictionary<string, string>();
 | 
				
			||||||
 | 
					                Dictionary<string, string> dictdesc = new Dictionary<string, string>();
 | 
				
			||||||
 | 
					                dicttitle.Add("en", "test"); dicttitle.Add("fr", "tester");
 | 
				
			||||||
 | 
					                dictdesc.Add("en", "test"); dictdesc.Add("fr", "tester");
 | 
				
			||||||
 | 
					                List<DoculinkTranslation> DocuLinksTranslations = new List<DoculinkTranslation>();
 | 
				
			||||||
 | 
					                DocuLinksTranslations.Add(new DoculinkTranslation()
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Language = "en",
 | 
				
			||||||
 | 
					                    title = "tel" + i,
 | 
				
			||||||
 | 
					                    description = "Sample" + i
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                List<DoculinkAttachments> doclinksAttachments = new List<DoculinkAttachments>();
 | 
				
			||||||
 | 
					                doclinksAttachments.Add(new DoculinkAttachments()
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    docName = "",
 | 
				
			||||||
 | 
					                    Path = "www.google.com",
 | 
				
			||||||
 | 
					                    IsAttachments = false,
 | 
				
			||||||
 | 
					                    CustomOrder = 1
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                list.Add(new DocuLinks.Models.ResDoculink()
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    Id = i,
 | 
				
			||||||
 | 
					                    linkTypeId = i,
 | 
				
			||||||
 | 
					                    IsActive = true,
 | 
				
			||||||
 | 
					                    titles = dicttitle,
 | 
				
			||||||
 | 
					                    description = dictdesc,
 | 
				
			||||||
 | 
					                    CustomOrder = i,
 | 
				
			||||||
 | 
					                    doclinksAttachments = doclinksAttachments
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return (true, list, null);
 | 
					            return (true, list, null);
 | 
				
			||||||
@ -64,6 +109,11 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            return (false, null, "Not Found");
 | 
					            return (false, null, "Not Found");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        public static async Task<(bool, IEnumerable<DocuLinks.Models.ResDoculinks>, string)> getNoContentResponses()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            IEnumerable<DocuLinks.Models.ResDoculinks> list = new List<DocuLinks.Models.ResDoculinks>();
 | 
				
			||||||
 | 
					            return (false, list, null);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        public static async Task<(bool, IEnumerable<DocuLinks.Models.ResDoculink>, string)> getNoContentResponse()
 | 
					        public static async Task<(bool, IEnumerable<DocuLinks.Models.ResDoculink>, string)> getNoContentResponse()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            IEnumerable<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
 | 
					            IEnumerable<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
 | 
				
			||||||
@ -73,8 +123,8 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            List<FileModel> fileModels = new List<FileModel>();
 | 
					            List<FileModel> fileModels = new List<FileModel>();
 | 
				
			||||||
            fileModels.Add( new FileModel() { FileName = "Sample", FileContent = "c2FtcGxl", FileExtension = ".txt",IsAttachments=true,CustomOrder=1 });
 | 
					            fileModels.Add(new FileModel() { FileName = "Sample", FileContent = "c2FtcGxl", FileExtension = ".txt", IsAttachments = true, CustomOrder = 1 });
 | 
				
			||||||
            return new ReqDoculink() { Id=id, linkTypeId = 1, CustomOrder = 1, Files = fileModels };
 | 
					            return new ReqDoculink() { Id = id, linkTypeId = 1, CustomOrder = 1, Files = fileModels };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public static async Task<DocuLinks.Models.Doculink> getInputDocumentData()
 | 
					        public static async Task<DocuLinks.Models.Doculink> getInputDocumentData()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@ -84,13 +134,14 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
                Language = "en",
 | 
					                Language = "en",
 | 
				
			||||||
                title = "tel",
 | 
					                title = "tel",
 | 
				
			||||||
                description = "Sample"
 | 
					                description = "Sample"
 | 
				
			||||||
            }); 
 | 
					            });
 | 
				
			||||||
            List<DoculinkAttachments> doclinksAttachments = new List<DoculinkAttachments>();
 | 
					            List<DoculinkAttachments> doclinksAttachments = new List<DoculinkAttachments>();
 | 
				
			||||||
            doclinksAttachments.Add(new DoculinkAttachments()
 | 
					            doclinksAttachments.Add(new DoculinkAttachments()
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                docName = "",
 | 
					                docName = "",
 | 
				
			||||||
                Path = "www.google.com",
 | 
					                Path = "www.google.com",
 | 
				
			||||||
                IsAttachments = false,
 | 
					                IsAttachments = false,
 | 
				
			||||||
 | 
					                Language = "en",
 | 
				
			||||||
                CustomOrder = 1
 | 
					                CustomOrder = 1
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            return new Models.Doculink
 | 
					            return new Models.Doculink
 | 
				
			||||||
@ -98,9 +149,9 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
                Id = 1,
 | 
					                Id = 1,
 | 
				
			||||||
                linkTypeId = 1,
 | 
					                linkTypeId = 1,
 | 
				
			||||||
                IsActive = true,
 | 
					                IsActive = true,
 | 
				
			||||||
                CustomOrder=1,
 | 
					                CustomOrder = 1,
 | 
				
			||||||
                documentsTranslations = DocuLinksTranslations,
 | 
					                documentsTranslations = DocuLinksTranslations,
 | 
				
			||||||
                doclinksAttachments= doclinksAttachments
 | 
					                doclinksAttachments = doclinksAttachments
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public static async Task<List<DocuLinks.Models.Doculink>> getInputDocuLinksData()
 | 
					        public static async Task<List<DocuLinks.Models.Doculink>> getInputDocuLinksData()
 | 
				
			||||||
@ -118,6 +169,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
 | 
				
			|||||||
                docName = "",
 | 
					                docName = "",
 | 
				
			||||||
                Path = "www.google.com",
 | 
					                Path = "www.google.com",
 | 
				
			||||||
                IsAttachments = false,
 | 
					                IsAttachments = false,
 | 
				
			||||||
 | 
					                Language="en",
 | 
				
			||||||
                CustomOrder = 1
 | 
					                CustomOrder = 1
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            List<DocuLinks.Models.Doculink> DocuLinks = new List<Models.Doculink>();
 | 
					            List<DocuLinks.Models.Doculink> DocuLinks = new List<Models.Doculink>();
 | 
				
			||||||
 | 
				
			|||||||
@ -144,7 +144,21 @@ namespace DamageAssesment.Api.DocuLinks.Controllers
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            return NoContent();
 | 
					            return NoContent();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Get all active Doculink.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Route("doculinks/active/{linktypeid:int}")]
 | 
				
			||||||
 | 
					        [Route("doculinks/active/{linktypeid:int}/{language:alpha}")]
 | 
				
			||||||
 | 
					        [HttpGet]
 | 
				
			||||||
 | 
					        public async Task<IActionResult> GetDocumentsByActiveLinkTypeIdAsync(int? linktypeid, string? language)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var result = await this.documentsProvider.GetdocumentsByLinkTypeIdAsync(linktypeid, language, true);
 | 
				
			||||||
 | 
					            if (result.IsSuccess)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return Ok(result.documents);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return NoContent();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Get a Doculink by id.
 | 
					        /// Get a Doculink by id.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
@ -176,7 +190,7 @@ namespace DamageAssesment.Api.DocuLinks.Controllers
 | 
				
			|||||||
                if (dbdoc.IsSuccess)
 | 
					                if (dbdoc.IsSuccess)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    var documents = await this.documentsProvider.GetDocumentCounter();
 | 
					                    var documents = await this.documentsProvider.GetDocumentCounter();
 | 
				
			||||||
                    Models.Doculink DocuLink= uploadService.UpdateDocuments(documents.counter,dbdoc.Document, documentInfo);
 | 
					                    Models.Doculink DocuLink= await azureBlobService.UpdateDocuments(documents.counter,dbdoc.Document, documentInfo);
 | 
				
			||||||
                    var result = await this.documentsProvider.UpdateDocumentAsync(id, DocuLink);
 | 
					                    var result = await this.documentsProvider.UpdateDocumentAsync(id, DocuLink);
 | 
				
			||||||
                    if (result.IsSuccess)
 | 
					                    if (result.IsSuccess)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,12 @@
 | 
				
			|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
					<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <PropertyGroup>
 | 
					  <PropertyGroup>
 | 
				
			||||||
    <TargetFramework>net6.0</TargetFramework>
 | 
					    <TargetFramework>net6.0</TargetFramework>
 | 
				
			||||||
    <Nullable>enable</Nullable>
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
					    <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
					    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
				
			||||||
 | 
					    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
 | 
				
			||||||
 | 
					    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
@ -23,6 +25,7 @@
 | 
				
			|||||||
      <PrivateAssets>all</PrivateAssets>
 | 
					      <PrivateAssets>all</PrivateAssets>
 | 
				
			||||||
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
 | 
					      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
 | 
				
			||||||
    </PackageReference>
 | 
					    </PackageReference>
 | 
				
			||||||
 | 
					    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
 | 
				
			||||||
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
					    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Db
 | 
					namespace DamageAssesment.Api.DocuLinks.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("Doculinks")]
 | 
				
			||||||
    public class Doculink
 | 
					    public class Doculink
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Db
 | 
					namespace DamageAssesment.Api.DocuLinks.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("DoculinkAttachments")]
 | 
				
			||||||
    public class DoculinkAttachments
 | 
					    public class DoculinkAttachments
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -14,5 +15,6 @@ namespace DamageAssesment.Api.DocuLinks.Db
 | 
				
			|||||||
        public string Path { get; set; }
 | 
					        public string Path { get; set; }
 | 
				
			||||||
        public bool IsAttachments { get; set; }
 | 
					        public bool IsAttachments { get; set; }
 | 
				
			||||||
        public int CustomOrder { get; set; }
 | 
					        public int CustomOrder { get; set; }
 | 
				
			||||||
 | 
					        public string Language { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@ namespace DamageAssesment.Api.DocuLinks.Db
 | 
				
			|||||||
        protected override void OnConfiguring(DbContextOptionsBuilder options)
 | 
					        protected override void OnConfiguring(DbContextOptionsBuilder options)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // connect to sql server with connection string from app settings
 | 
					            // connect to sql server with connection string from app settings
 | 
				
			||||||
            options.UseSqlServer(_Configuration.GetConnectionString("DoculinConnection"));
 | 
					            options.UseSqlServer(_Configuration.GetConnectionString("DoculinkConnection"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public DbSet<Db.Doculink> Documents { get; set; }
 | 
					        public DbSet<Db.Doculink> Documents { get; set; }
 | 
				
			||||||
        public DbSet<Db.LinkType> LinkTypes { get; set; }
 | 
					        public DbSet<Db.LinkType> LinkTypes { get; set; }
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Db
 | 
					namespace DamageAssesment.Api.DocuLinks.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("DoculinkTrans")]
 | 
				
			||||||
    public class DoculinkTranslation
 | 
					    public class DoculinkTranslation
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,9 @@
 | 
				
			|||||||
using System.ComponentModel.DataAnnotations;
 | 
					using System.ComponentModel.DataAnnotations;
 | 
				
			||||||
 | 
					using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Db
 | 
					namespace DamageAssesment.Api.DocuLinks.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("DoculinkTypes")]
 | 
				
			||||||
    public class LinkType
 | 
					    public class LinkType
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Db
 | 
					namespace DamageAssesment.Api.DocuLinks.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("DoculinkTypeTrans")]
 | 
				
			||||||
    public class LinksTranslation
 | 
					    public class LinksTranslation
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										30
									
								
								DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					EXPOSE 80
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 | 
				
			||||||
 | 
					WORKDIR /src
 | 
				
			||||||
 | 
					COPY ["DamageAssesment.Api.DocuLinks/DamageAssesment.Api.DocuLinks.csproj", "DamageAssesment.Api.DocuLinks/"]
 | 
				
			||||||
 | 
					RUN dotnet restore "DamageAssesment.Api.DocuLinks/DamageAssesment.Api.DocuLinks.csproj"
 | 
				
			||||||
 | 
					COPY . .
 | 
				
			||||||
 | 
					WORKDIR "/src/DamageAssesment.Api.DocuLinks"
 | 
				
			||||||
 | 
					RUN dotnet build "DamageAssesment.Api.DocuLinks.csproj" -c Release -o /app/build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM build AS publish
 | 
				
			||||||
 | 
					RUN dotnet publish "DamageAssesment.Api.DocuLinks.csproj" -c Release -o /app/publish /p:UseAppHost=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM base AS final
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					COPY --from=publish /app/publish .
 | 
				
			||||||
 | 
					# Create directories for attachments and set permissions
 | 
				
			||||||
 | 
					RUN mkdir -p /app/DASA_Documents/Active && \
 | 
				
			||||||
 | 
					    mkdir -p /app/DASA_Documents/Deleted && \
 | 
				
			||||||
 | 
					    chown -R www-data:www-data /app/DASA_Documents
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Update appsettings.json with the correct paths for attachments
 | 
				
			||||||
 | 
					RUN sed -i 's#"folderpath": "DASA_Documents/Active"#"folderpath": "/app/DASA_Documents/Active"#' appsettings.json && \
 | 
				
			||||||
 | 
					    sed -i 's#"Deletepath": "DASA_Documents/Deleted"#"Deletepath": "/app/DASA_Documents/Deleted"#' appsettings.json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ENTRYPOINT ["dotnet", "DamageAssesment.Api.DocuLinks.dll"]
 | 
				
			||||||
@ -6,10 +6,11 @@ namespace DamageAssesment.Api.DocuLinks.Interfaces
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> GetDocumentAsync(int id, string? linktype, string? language);
 | 
					        Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> GetDocumentAsync(int id, string? linktype, string? language);
 | 
				
			||||||
        Task<(bool IsSuccess, Models.Doculink Document, string ErrorMessage)> GetDocumentByidAsync(int id);
 | 
					        Task<(bool IsSuccess, Models.Doculink Document, string ErrorMessage)> GetDocumentByidAsync(int id);
 | 
				
			||||||
       // Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetDocumnetsAsync(string? language);
 | 
					        // Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetDocumnetsAsync(string? language);
 | 
				
			||||||
        Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive);
 | 
					        Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive);
 | 
				
			||||||
 | 
					        Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive);
 | 
				
			||||||
        Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> PostDocumentAsync(Models.Doculink Document);
 | 
					        Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> PostDocumentAsync(Models.Doculink Document);
 | 
				
			||||||
        Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> UpdateDocumentAsync(int id,Models.Doculink Document);
 | 
					        Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> UpdateDocumentAsync(int id, Models.Doculink Document);
 | 
				
			||||||
        Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> DeleteDocumentAsync(int id);
 | 
					        Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> DeleteDocumentAsync(int id);
 | 
				
			||||||
        Task<(bool IsSuccess, int counter, string message)> GetDocumentCounter();
 | 
					        Task<(bool IsSuccess, int counter, string message)> GetDocumentCounter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,95 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.DocuLinks.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(DoculinkDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230828165655_InitialDocumentCreate")]
 | 
					 | 
				
			||||||
    partial class InitialDocumentCreate
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.Document", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Path")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("dateCreated")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("dateUpdated")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("description")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("docName")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("linkTypeId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("title")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("url")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Documents");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.LinkType", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("TypeText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("LinkTypes");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,60 +0,0 @@
 | 
				
			|||||||
using System;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class InitialDocumentCreate : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "Documents",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    title = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    linkTypeId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    description = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    docName = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    url = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    Path = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
 | 
					 | 
				
			||||||
                    dateCreated = table.Column<DateTime>(type: "datetime2", nullable: false),
 | 
					 | 
				
			||||||
                    dateUpdated = table.Column<DateTime>(type: "datetime2", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_Documents", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "LinkTypes",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    TypeText = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    IsActive = table.Column<bool>(type: "bit", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_LinkTypes", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "Documents");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "LinkTypes");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,118 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.DocuLinks.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(DoculinkDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230830200432_DocumentTranslation")]
 | 
					 | 
				
			||||||
    partial class DocumentTranslation
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.Document", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Path")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("dateCreated")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("dateUpdated")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("docName")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("linkTypeId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("url")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Documents");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.DocumentsTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("DocumentId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("description")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("title")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("DocumentsTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.LinkType", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsAttachment")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("TypeText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("LinkTypes");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,70 +0,0 @@
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class DocumentTranslation : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "description",
 | 
					 | 
				
			||||||
                table: "Documents");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "title",
 | 
					 | 
				
			||||||
                table: "Documents");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<bool>(
 | 
					 | 
				
			||||||
                name: "IsAttachment",
 | 
					 | 
				
			||||||
                table: "LinkTypes",
 | 
					 | 
				
			||||||
                type: "bit",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: false);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "DocumentsTranslations",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    DocumentId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    title = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    description = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    Language = table.Column<string>(type: "nvarchar(max)", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_DocumentsTranslations", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "DocumentsTranslations");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "IsAttachment",
 | 
					 | 
				
			||||||
                table: "LinkTypes");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<string>(
 | 
					 | 
				
			||||||
                name: "description",
 | 
					 | 
				
			||||||
                table: "Documents",
 | 
					 | 
				
			||||||
                type: "nvarchar(max)",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<string>(
 | 
					 | 
				
			||||||
                name: "title",
 | 
					 | 
				
			||||||
                table: "Documents",
 | 
					 | 
				
			||||||
                type: "nvarchar(max)",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: "");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,162 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.DocuLinks.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(DoculinkDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230926163717_doculinkUpdate")]
 | 
					 | 
				
			||||||
    partial class doculinkUpdate
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.Doculink", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CustomOrder")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsDeleted")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("dateCreated")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("dateUpdated")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("linkTypeId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Documents");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.DoculinkAttachments", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CustomOrder")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("DocumentId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsAttachments")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Path")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("docName")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("DoclinksAttachments");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.DoculinkTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("DocumentId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("description")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("title")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("DocumentsTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.LinkType", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CustomOrder")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("LinkTypes");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.LinksTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("LinkTypeId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("TypeText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("LinksTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,144 +0,0 @@
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class doculinkUpdate : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "IsAttachment",
 | 
					 | 
				
			||||||
                table: "LinkTypes");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "TypeText",
 | 
					 | 
				
			||||||
                table: "LinkTypes");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "Path",
 | 
					 | 
				
			||||||
                table: "Documents");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "docName",
 | 
					 | 
				
			||||||
                table: "Documents");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "url",
 | 
					 | 
				
			||||||
                table: "Documents");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<int>(
 | 
					 | 
				
			||||||
                name: "CustomOrder",
 | 
					 | 
				
			||||||
                table: "LinkTypes",
 | 
					 | 
				
			||||||
                type: "int",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<int>(
 | 
					 | 
				
			||||||
                name: "CustomOrder",
 | 
					 | 
				
			||||||
                table: "Documents",
 | 
					 | 
				
			||||||
                type: "int",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<bool>(
 | 
					 | 
				
			||||||
                name: "IsDeleted",
 | 
					 | 
				
			||||||
                table: "Documents",
 | 
					 | 
				
			||||||
                type: "bit",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: false);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "DoclinksAttachments",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    DocumentId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    docName = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    Path = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    IsAttachments = table.Column<bool>(type: "bit", nullable: false),
 | 
					 | 
				
			||||||
                    CustomOrder = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_DoclinksAttachments", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "LinksTranslations",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    LinkTypeId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    TypeText = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    Language = table.Column<string>(type: "nvarchar(max)", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_LinksTranslations", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "DoclinksAttachments");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "LinksTranslations");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "CustomOrder",
 | 
					 | 
				
			||||||
                table: "LinkTypes");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "CustomOrder",
 | 
					 | 
				
			||||||
                table: "Documents");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropColumn(
 | 
					 | 
				
			||||||
                name: "IsDeleted",
 | 
					 | 
				
			||||||
                table: "Documents");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<bool>(
 | 
					 | 
				
			||||||
                name: "IsAttachment",
 | 
					 | 
				
			||||||
                table: "LinkTypes",
 | 
					 | 
				
			||||||
                type: "bit",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: false);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<string>(
 | 
					 | 
				
			||||||
                name: "TypeText",
 | 
					 | 
				
			||||||
                table: "LinkTypes",
 | 
					 | 
				
			||||||
                type: "nvarchar(max)",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<string>(
 | 
					 | 
				
			||||||
                name: "Path",
 | 
					 | 
				
			||||||
                table: "Documents",
 | 
					 | 
				
			||||||
                type: "nvarchar(max)",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<string>(
 | 
					 | 
				
			||||||
                name: "docName",
 | 
					 | 
				
			||||||
                table: "Documents",
 | 
					 | 
				
			||||||
                type: "nvarchar(max)",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.AddColumn<string>(
 | 
					 | 
				
			||||||
                name: "url",
 | 
					 | 
				
			||||||
                table: "Documents",
 | 
					 | 
				
			||||||
                type: "nvarchar(max)",
 | 
					 | 
				
			||||||
                nullable: false,
 | 
					 | 
				
			||||||
                defaultValue: "");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,159 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.DocuLinks.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(DoculinkDbContext))]
 | 
					 | 
				
			||||||
    partial class DocumentDbContextModelSnapshot : ModelSnapshot
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        protected override void BuildModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.Doculink", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CustomOrder")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsDeleted")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("dateCreated")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("dateUpdated")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("linkTypeId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Documents");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.DoculinkAttachments", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CustomOrder")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("DocumentId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsAttachments")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Path")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("docName")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("DoclinksAttachments");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.DoculinkTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("DocumentId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("description")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("title")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("DocumentsTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.LinkType", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CustomOrder")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("LinkTypes");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.DocuLinks.Db.LinksTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("LinkTypeId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("TypeText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("LinksTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -7,6 +7,11 @@ namespace DamageAssesment.Api.DocuLinks.Models
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        public List<DoculinkTranslation> documentsTranslations { get; set; }
 | 
					        public List<DoculinkTranslation> documentsTranslations { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    public class ResDoculinks
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public int linkTypeId { get; set; }
 | 
				
			||||||
 | 
					        public List<ResDoculink> doculinks { get; set; }   
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    public class ResDoculink:BaseDoculink
 | 
					    public class ResDoculink:BaseDoculink
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public object titles { get; set; }
 | 
					        public object titles { get; set; }
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@ namespace DamageAssesment.Api.DocuLinks.Models
 | 
				
			|||||||
        public string docName { get; set; }
 | 
					        public string docName { get; set; }
 | 
				
			||||||
        public string Path { get; set; }
 | 
					        public string Path { get; set; }
 | 
				
			||||||
        public bool IsAttachments { get; set; }
 | 
					        public bool IsAttachments { get; set; }
 | 
				
			||||||
 | 
					        public string Language { get; set; }
 | 
				
			||||||
        public int CustomOrder { get; set; }
 | 
					        public int CustomOrder { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@ namespace DamageAssesment.Api.DocuLinks.Models
 | 
				
			|||||||
        public string? FileExtension { get; set; }
 | 
					        public string? FileExtension { get; set; }
 | 
				
			||||||
        public int CustomOrder { get; set; }
 | 
					        public int CustomOrder { get; set; }
 | 
				
			||||||
        public string url { get;set; }
 | 
					        public string url { get;set; }
 | 
				
			||||||
 | 
					        public string Language { get; set; }
 | 
				
			||||||
        public bool IsAttachments { get; set; }
 | 
					        public bool IsAttachments { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -75,7 +75,7 @@ builder.Services.AddScoped<IAzureBlobService, AzureBlobService>();
 | 
				
			|||||||
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
 | 
					builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
 | 
				
			||||||
builder.Services.AddDbContext<DoculinkDbContext>(option =>
 | 
					builder.Services.AddDbContext<DoculinkDbContext>(option =>
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    option.UseSqlServer("DoculinConnection");
 | 
					    option.UseSqlServer("DoculinkConnection");
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
var app = builder.Build();
 | 
					var app = builder.Build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,23 +1,14 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
					 | 
				
			||||||
  "iisSettings": {
 | 
					 | 
				
			||||||
    "windowsAuthentication": false,
 | 
					 | 
				
			||||||
    "anonymousAuthentication": true,
 | 
					 | 
				
			||||||
    "iisExpress": {
 | 
					 | 
				
			||||||
      "applicationUrl": "http://localhost:60754",
 | 
					 | 
				
			||||||
      "sslPort": 0
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "profiles": {
 | 
					  "profiles": {
 | 
				
			||||||
    "DamageAssesment.Api.Questions": {
 | 
					    "DamageAssesment.Api.Doculinks": {
 | 
				
			||||||
      "commandName": "Project",
 | 
					      "commandName": "Project",
 | 
				
			||||||
      "dotnetRunMessages": true,
 | 
					 | 
				
			||||||
      "launchBrowser": true,
 | 
					      "launchBrowser": true,
 | 
				
			||||||
      "launchUrl": "swagger",
 | 
					      "launchUrl": "swagger",
 | 
				
			||||||
      "applicationUrl": "http://localhost:5136",
 | 
					 | 
				
			||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      },
 | 
				
			||||||
 | 
					      "dotnetRunMessages": true,
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:5136"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "IIS Express": {
 | 
					    "IIS Express": {
 | 
				
			||||||
      "commandName": "IISExpress",
 | 
					      "commandName": "IISExpress",
 | 
				
			||||||
@ -26,6 +17,24 @@
 | 
				
			|||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "Docker": {
 | 
				
			||||||
 | 
					      "commandName": "Docker",
 | 
				
			||||||
 | 
					      "launchBrowser": true,
 | 
				
			||||||
 | 
					      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
 | 
				
			||||||
 | 
					      "environmentVariables": {
 | 
				
			||||||
 | 
					        "ASPNETCORE_URLS": "http://+:80"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "publishAllPorts": true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
				
			||||||
 | 
					  "iisSettings": {
 | 
				
			||||||
 | 
					    "windowsAuthentication": false,
 | 
				
			||||||
 | 
					    "anonymousAuthentication": true,
 | 
				
			||||||
 | 
					    "iisExpress": {
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:14425",
 | 
				
			||||||
 | 
					      "sslPort": 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -15,7 +15,7 @@ using System.Threading.Tasks;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.DocuLinks.Providers
 | 
					namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public class AzureBlobService: IAzureBlobService
 | 
					    public class AzureBlobService : IAzureBlobService
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        BlobServiceClient _blobClient;
 | 
					        BlobServiceClient _blobClient;
 | 
				
			||||||
        BlobContainerClient _containerClient;
 | 
					        BlobContainerClient _containerClient;
 | 
				
			||||||
@ -32,7 +32,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
        public async Task<Models.Doculink> UploadDocument(int counter, ReqDoculink documentInfo)
 | 
					        public async Task<Models.Doculink> UploadDocument(int counter, ReqDoculink documentInfo)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Models.Doculink Documents = new Models.Doculink();
 | 
					            Models.Doculink Documents = new Models.Doculink();
 | 
				
			||||||
            List <Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
 | 
					            List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                string path = "", UserfileName = "";
 | 
					                string path = "", UserfileName = "";
 | 
				
			||||||
@ -55,7 +55,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else
 | 
					                        else
 | 
				
			||||||
                            path = item.url;
 | 
					                            path = item.url;
 | 
				
			||||||
                        attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder });
 | 
					                        attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder, Language = item.Language });
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                Documents = new Models.Doculink()
 | 
					                Documents = new Models.Doculink()
 | 
				
			||||||
@ -84,7 +84,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                foreach (var item in document.doclinksAttachments)
 | 
					                foreach (var item in document.doclinksAttachments)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                     Movefile(item.Path);
 | 
					                    Movefile(item.Path);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                string path = "", UserfileName = "";
 | 
					                string path = "", UserfileName = "";
 | 
				
			||||||
                List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
 | 
					                List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
 | 
				
			||||||
@ -104,7 +104,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else
 | 
					                    else
 | 
				
			||||||
                        path = item.url;
 | 
					                        path = item.url;
 | 
				
			||||||
                    attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder });
 | 
					                    attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder, Language = item.Language });
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                Models.Doculink Documents = new Models.Doculink()
 | 
					                Models.Doculink Documents = new Models.Doculink()
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@ -148,7 +148,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            var list = movefilename.Split('.');
 | 
					            var list = movefilename.Split('.');
 | 
				
			||||||
            if (list.Length > 0)
 | 
					            if (list.Length > 0)
 | 
				
			||||||
                list[list.Length - 1] = DateTime.Now.ToShortDateString().Replace("/", "_") +"_"+ DateTime.Now.ToShortTimeString().Replace("/", "_")+"." + list[list.Length - 1];
 | 
					                list[list.Length - 1] = DateTime.Now.ToShortDateString().Replace("/", "_") + "_" + DateTime.Now.ToShortTimeString().Replace("/", "_") + "." + list[list.Length - 1];
 | 
				
			||||||
            return string.Join("_", list);
 | 
					            return string.Join("_", list);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public void Movefile(string path)
 | 
					        public void Movefile(string path)
 | 
				
			||||||
@ -162,28 +162,28 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                    BlobClient sourceBlobClient = _containerClient.GetBlobClient(path);
 | 
					                    BlobClient sourceBlobClient = _containerClient.GetBlobClient(path);
 | 
				
			||||||
                    BlobClient destinationBlobClient = _containerClient.GetBlobClient(MovePath);
 | 
					                    BlobClient destinationBlobClient = _containerClient.GetBlobClient(MovePath);
 | 
				
			||||||
                    // Start the copy operation from the source to the destination
 | 
					                    // Start the copy operation from the source to the destination
 | 
				
			||||||
                     destinationBlobClient.StartCopyFromUri(sourceBlobClient.Uri);
 | 
					                    destinationBlobClient.StartCopyFromUri(sourceBlobClient.Uri);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // Check if the copy operation completed successfully
 | 
					                    // Check if the copy operation completed successfully
 | 
				
			||||||
                     WaitForCopyToComplete(destinationBlobClient);
 | 
					                    WaitForCopyToComplete(destinationBlobClient);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // Delete the source blob after a successful copy
 | 
					                    // Delete the source blob after a successful copy
 | 
				
			||||||
                     sourceBlobClient.DeleteIfExists();
 | 
					                    sourceBlobClient.DeleteIfExists();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch(Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        static void  WaitForCopyToComplete(BlobClient blobClient)
 | 
					        static void WaitForCopyToComplete(BlobClient blobClient)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            BlobProperties properties =  blobClient.GetProperties();
 | 
					            BlobProperties properties = blobClient.GetProperties();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            while (properties.CopyStatus == CopyStatus.Pending)
 | 
					            while (properties.CopyStatus == CopyStatus.Pending)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                 Task.Delay(TimeSpan.FromSeconds(1));
 | 
					                Task.Delay(TimeSpan.FromSeconds(1));
 | 
				
			||||||
                properties =  blobClient.GetProperties();
 | 
					                properties = blobClient.GetProperties();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public void DeleteFile(string url)
 | 
					        public void DeleteFile(string url)
 | 
				
			||||||
 | 
				
			|||||||
@ -65,10 +65,10 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                int counter = 0;
 | 
					                int counter = 0;
 | 
				
			||||||
                for (int i = 1; i <= 4; i++)
 | 
					                for (int i = 1; i <= 4; i++)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    FileModel fileModel = new FileModel() { url = "www.google"+i+".com", IsAttachments = false, CustomOrder = 1 };
 | 
					                    FileModel fileModel = new FileModel() { url = "www.google" + i + ".com", IsAttachments = false, CustomOrder = 1 };
 | 
				
			||||||
                    ReqDoculink documentInfo = new ReqDoculink() { linkTypeId = i,CustomOrder=i, Files = new List<FileModel>() { fileModel } };
 | 
					                    ReqDoculink documentInfo = new ReqDoculink() { linkTypeId = i, CustomOrder = i, Files = new List<FileModel>() { fileModel } };
 | 
				
			||||||
                    Db.DoculinkTranslation documents = new Db.DoculinkTranslation { DocumentId = i, title = "Test"+i, description = "ss"+i, Language = "en" };
 | 
					                    Db.DoculinkTranslation documents = new Db.DoculinkTranslation { DocumentId = i, title = "Test" + i, description = "ss" + i, Language = "en" };
 | 
				
			||||||
                    Models.Doculink document =await azureBlobService.UploadDocument(counter, documentInfo);
 | 
					                    Models.Doculink document = await azureBlobService.UploadDocument(counter, documentInfo);
 | 
				
			||||||
                    DocumentDbContext.Documents.Add(mapper.Map<Models.Doculink, Db.Doculink>(document));
 | 
					                    DocumentDbContext.Documents.Add(mapper.Map<Models.Doculink, Db.Doculink>(document));
 | 
				
			||||||
                    DocumentDbContext.SaveChanges();
 | 
					                    DocumentDbContext.SaveChanges();
 | 
				
			||||||
                    DocumentDbContext.DocumentsTranslations.AddRange(documents);
 | 
					                    DocumentDbContext.DocumentsTranslations.AddRange(documents);
 | 
				
			||||||
@ -135,6 +135,54 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
            MultiLanguage = dicttitle;
 | 
					            MultiLanguage = dicttitle;
 | 
				
			||||||
            return MultiLanguage;
 | 
					            return MultiLanguage;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        private List<Models.DoculinkAttachments> GetDocumentAttachment(int id, string? language)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (string.IsNullOrEmpty(language))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
 | 
				
			||||||
 | 
					                    DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id).ToList());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
 | 
				
			||||||
 | 
					                DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id && a.Language == language).ToList());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                logger?.LogInformation("Query Question");
 | 
				
			||||||
 | 
					                var documents = new List<Db.Doculink>();
 | 
				
			||||||
 | 
					                if (linkTypeId == null)
 | 
				
			||||||
 | 
					                    documents = await DocumentDbContext.Documents.AsNoTracking().Where(q => (isactive == null || q.IsActive == isactive.Value)).ToListAsync();
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                    documents = await DocumentDbContext.Documents.AsNoTracking().Where(q => (isactive == null || q.IsActive == isactive.Value) &&
 | 
				
			||||||
 | 
					                     q.linkTypeId == linkTypeId.Value).ToListAsync();
 | 
				
			||||||
 | 
					                if (documents != null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var result = mapper.Map<List<Db.Doculink>, List<Models.ResDoculink>>(documents);
 | 
				
			||||||
 | 
					                    foreach (var item in result)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        var multilan = CreateMultiLanguageObject(GetDocumentTranslations(item.Id, language));
 | 
				
			||||||
 | 
					                        item.titles = multilan.titles;
 | 
				
			||||||
 | 
					                        item.description = multilan.description;
 | 
				
			||||||
 | 
					                        item.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(item.linkTypeId, language));
 | 
				
			||||||
 | 
					                        item.doclinksAttachments = GetDocumentAttachment(item.Id, language);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    // List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
 | 
				
			||||||
 | 
					                    return (true, result, null);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return (false, null, "Not found");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                logger?.LogError(ex.ToString());
 | 
				
			||||||
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive)
 | 
					        public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -156,8 +204,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                        item.titles = multilan.titles;
 | 
					                        item.titles = multilan.titles;
 | 
				
			||||||
                        item.description = multilan.description;
 | 
					                        item.description = multilan.description;
 | 
				
			||||||
                        item.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(item.linkTypeId, language));
 | 
					                        item.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(item.linkTypeId, language));
 | 
				
			||||||
                        item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
 | 
					                        item.doclinksAttachments = GetDocumentAttachment(item.Id, language);
 | 
				
			||||||
                            DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList());
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    return (true, result, null);
 | 
					                    return (true, result, null);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -211,8 +258,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                    result.documentsTranslations = mapper.Map<List<Db.DoculinkTranslation>, List<Models.DoculinkTranslation>>(
 | 
					                    result.documentsTranslations = mapper.Map<List<Db.DoculinkTranslation>, List<Models.DoculinkTranslation>>(
 | 
				
			||||||
                            DocumentDbContext.DocumentsTranslations.Where(a => a.DocumentId == result.Id).ToList());
 | 
					                            DocumentDbContext.DocumentsTranslations.Where(a => a.DocumentId == result.Id).ToList());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    result.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
 | 
					                    result.doclinksAttachments = GetDocumentAttachment(id, "");
 | 
				
			||||||
                        DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id).ToList());
 | 
					 | 
				
			||||||
                    return (true, result, null);
 | 
					                    return (true, result, null);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return (false, null, "Not found");
 | 
					                return (false, null, "Not found");
 | 
				
			||||||
@ -244,8 +290,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                    result.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(result.linkTypeId, language));
 | 
					                    result.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(result.linkTypeId, language));
 | 
				
			||||||
                    result.titles = multilan.titles;
 | 
					                    result.titles = multilan.titles;
 | 
				
			||||||
                    result.description = multilan.description;
 | 
					                    result.description = multilan.description;
 | 
				
			||||||
                    result.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
 | 
					                    result.doclinksAttachments = GetDocumentAttachment(id, language);
 | 
				
			||||||
                        DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id).ToList());
 | 
					 | 
				
			||||||
                    return (true, result, null);
 | 
					                    return (true, result, null);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return (false, null, "Not found");
 | 
					                return (false, null, "Not found");
 | 
				
			||||||
@ -356,8 +401,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                result.titles = multilan.titles;
 | 
					                result.titles = multilan.titles;
 | 
				
			||||||
                result.description = multilan.description;
 | 
					                result.description = multilan.description;
 | 
				
			||||||
                result.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(result.linkTypeId, ""));
 | 
					                result.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(result.linkTypeId, ""));
 | 
				
			||||||
                result.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
 | 
					                result.doclinksAttachments = GetDocumentAttachment(id, "");
 | 
				
			||||||
                    DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id).ToList());
 | 
					 | 
				
			||||||
                Document.IsActive = false;
 | 
					                Document.IsActive = false;
 | 
				
			||||||
                DocumentDbContext.Documents.Update(Document);
 | 
					                DocumentDbContext.Documents.Update(Document);
 | 
				
			||||||
                DocumentDbContext.SaveChanges();
 | 
					                DocumentDbContext.SaveChanges();
 | 
				
			||||||
 | 
				
			|||||||
@ -30,9 +30,9 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            Models.Doculink Documents = new Models.Doculink();
 | 
					            Models.Doculink Documents = new Models.Doculink();
 | 
				
			||||||
            List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
 | 
					            List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
 | 
				
			||||||
            try 
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                string path = "", UserfileName="";
 | 
					                string path = "", UserfileName = "";
 | 
				
			||||||
                var fullDirectoryPath = Path.Combine(Directory.GetCurrentDirectory(), uploadpath);
 | 
					                var fullDirectoryPath = Path.Combine(Directory.GetCurrentDirectory(), uploadpath);
 | 
				
			||||||
                if (!Directory.Exists(fullDirectoryPath)) //Create deirectory if does not exist
 | 
					                if (!Directory.Exists(fullDirectoryPath)) //Create deirectory if does not exist
 | 
				
			||||||
                    Directory.CreateDirectory(fullDirectoryPath);
 | 
					                    Directory.CreateDirectory(fullDirectoryPath);
 | 
				
			||||||
@ -51,20 +51,27 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else
 | 
					                        else
 | 
				
			||||||
                            path = item.url;
 | 
					                            path = item.url;
 | 
				
			||||||
                        attachments.Add(new Models.DoculinkAttachments { docName=UserfileName,Path=path,IsAttachments=item.IsAttachments,CustomOrder=item.CustomOrder });
 | 
					                        attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder, Language = item.Language });
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                Documents=new Models.Doculink (){ linkTypeId = documentInfo.linkTypeId,
 | 
					                Documents = new Models.Doculink()
 | 
				
			||||||
                    documentsTranslations = documentInfo.documentsTranslations,doclinksAttachments=attachments,
 | 
					                {
 | 
				
			||||||
                    IsDeleted=false,CustomOrder=documentInfo.CustomOrder, IsActive =true};
 | 
					                    linkTypeId = documentInfo.linkTypeId,
 | 
				
			||||||
            
 | 
					                    documentsTranslations = documentInfo.documentsTranslations,
 | 
				
			||||||
 | 
					                    doclinksAttachments = attachments,
 | 
				
			||||||
 | 
					                    IsDeleted = false,
 | 
				
			||||||
 | 
					                    CustomOrder = documentInfo.CustomOrder,
 | 
				
			||||||
 | 
					                    IsActive = true
 | 
				
			||||||
 | 
					                };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return Documents;
 | 
					                return Documents;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex) {
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                return new Models.Doculink();
 | 
					                return new Models.Doculink();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
           
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public Models.Doculink UpdateDocuments(int counter, Models.Doculink document, ReqDoculink documentInfo)
 | 
					        public Models.Doculink UpdateDocuments(int counter, Models.Doculink document, ReqDoculink documentInfo)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@ -93,15 +100,15 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else
 | 
					                    else
 | 
				
			||||||
                        path = item.url;
 | 
					                        path = item.url;
 | 
				
			||||||
                    attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path,IsAttachments=item.IsAttachments,CustomOrder=item.CustomOrder });
 | 
					                    attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder, Language = item.Language });
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                Models.Doculink Documents = new Models.Doculink()
 | 
					                Models.Doculink Documents = new Models.Doculink()
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Id = documentInfo.Id,
 | 
					                    Id = documentInfo.Id,
 | 
				
			||||||
                    linkTypeId = documentInfo.linkTypeId,
 | 
					                    linkTypeId = documentInfo.linkTypeId,
 | 
				
			||||||
                    documentsTranslations=documentInfo.documentsTranslations,
 | 
					                    documentsTranslations = documentInfo.documentsTranslations,
 | 
				
			||||||
                    IsActive = true,
 | 
					                    IsActive = true,
 | 
				
			||||||
                    IsDeleted=false,
 | 
					                    IsDeleted = false,
 | 
				
			||||||
                    CustomOrder = documentInfo.CustomOrder,
 | 
					                    CustomOrder = documentInfo.CustomOrder,
 | 
				
			||||||
                    doclinksAttachments = attachments
 | 
					                    doclinksAttachments = attachments
 | 
				
			||||||
                };
 | 
					                };
 | 
				
			||||||
@ -109,7 +116,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                return Documents;
 | 
					                return Documents;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
             catch (Exception ex) {
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                return new Models.Doculink();
 | 
					                return new Models.Doculink();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -118,7 +126,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
            if (path != "")
 | 
					            if (path != "")
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                FileInfo file = new FileInfo(path);
 | 
					                FileInfo file = new FileInfo(path);
 | 
				
			||||||
                if (file?.Exists??false)//check file exsit or not  
 | 
					                if (file?.Exists ?? false)//check file exsit or not  
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    file.Delete();
 | 
					                    file.Delete();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -134,8 +142,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
 | 
				
			|||||||
                FileInfo file = new FileInfo(path);
 | 
					                FileInfo file = new FileInfo(path);
 | 
				
			||||||
                if (file?.Exists ?? false)//check file exsit or not  
 | 
					                if (file?.Exists ?? false)//check file exsit or not  
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    string filename = file.Name.Replace(file.Extension, " ") + DateTime.Now.ToShortDateString().Replace("/","_") + file.Extension;
 | 
					                    string filename = file.Name.Replace(file.Extension, " ") + DateTime.Now.ToShortDateString().Replace("/", "_") + file.Extension;
 | 
				
			||||||
                    file.MoveTo(pathToSave+"\\"+ filename);
 | 
					                    file.MoveTo(pathToSave + "\\" + filename);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "Logging": {
 | 
					 | 
				
			||||||
    "LogLevel": {
 | 
					 | 
				
			||||||
      "Default": "Information",
 | 
					 | 
				
			||||||
      "Microsoft.AspNetCore": "Warning"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -9,11 +9,9 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "AllowedHosts": "*",
 | 
					  "AllowedHosts": "*",
 | 
				
			||||||
  //"ConnectionStrings": {
 | 
					 | 
				
			||||||
  //  "DoculinConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
					 | 
				
			||||||
  //},
 | 
					 | 
				
			||||||
  "ConnectionStrings": {
 | 
					  "ConnectionStrings": {
 | 
				
			||||||
    "DoculinConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
					    //"DoculinkConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
				
			||||||
 | 
					    "DoculinkConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "Fileupload": {
 | 
					  "Fileupload": {
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@ namespace DamageAssesment.Api.Employees.Controllers
 | 
				
			|||||||
        /// GET request for retrieving employees.
 | 
					        /// GET request for retrieving employees.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Employees")]
 | 
					        [HttpGet("employees")]
 | 
				
			||||||
        public async Task<ActionResult> GetEmployeesAsync()
 | 
					        public async Task<ActionResult> GetEmployeesAsync()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -37,7 +37,7 @@ namespace DamageAssesment.Api.Employees.Controllers
 | 
				
			|||||||
        /// GET request for retrieving an employee by ID.
 | 
					        /// GET request for retrieving an employee by ID.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Employees/{id}")]
 | 
					        [HttpGet("employees/{id}")]
 | 
				
			||||||
        public async Task<ActionResult> GetEmployeeByIdAsync(int id)
 | 
					        public async Task<ActionResult> GetEmployeeByIdAsync(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -55,7 +55,7 @@ namespace DamageAssesment.Api.Employees.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="Employee">The updated employee object.</param>
 | 
					        /// <param name="Employee">The updated employee object.</param>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPut("Employees/{id}")]
 | 
					        [HttpPut("employees/{id}")]
 | 
				
			||||||
        public async Task<IActionResult> UpdateEmployee(int id, Models.Employee Employee)
 | 
					        public async Task<IActionResult> UpdateEmployee(int id, Models.Employee Employee)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (Employee != null)
 | 
					            if (Employee != null)
 | 
				
			||||||
@ -78,7 +78,7 @@ namespace DamageAssesment.Api.Employees.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="Employee">The employee information for creating a new employee.</param>
 | 
					        /// <param name="Employee">The employee information for creating a new employee.</param>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPost("Employees")]
 | 
					        [HttpPost("employees")]
 | 
				
			||||||
        public async Task<IActionResult> CreateEmployee(Models.Employee Employee)
 | 
					        public async Task<IActionResult> CreateEmployee(Models.Employee Employee)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (Employee != null)
 | 
					            if (Employee != null)
 | 
				
			||||||
@ -97,7 +97,7 @@ namespace DamageAssesment.Api.Employees.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="id">The ID of the employee to be deleted.</param>
 | 
					        /// <param name="id">The ID of the employee to be deleted.</param>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpDelete("Employees/{id}")]
 | 
					        [HttpDelete("employees/{id}")]
 | 
				
			||||||
        public async Task<IActionResult> DeleteEmployee(int id)
 | 
					        public async Task<IActionResult> DeleteEmployee(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.EmployeeProvider.DeleteEmployeeAsync(id);
 | 
					            var result = await this.EmployeeProvider.DeleteEmployeeAsync(id);
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,8 @@
 | 
				
			|||||||
    <Nullable>enable</Nullable>
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
					    <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
					    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
				
			||||||
 | 
					    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
 | 
				
			||||||
 | 
					    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
@ -22,6 +24,7 @@
 | 
				
			|||||||
      <PrivateAssets>all</PrivateAssets>
 | 
					      <PrivateAssets>all</PrivateAssets>
 | 
				
			||||||
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
 | 
					      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
 | 
				
			||||||
    </PackageReference>
 | 
					    </PackageReference>
 | 
				
			||||||
 | 
					    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
 | 
				
			||||||
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
					    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,9 @@
 | 
				
			|||||||
using System.ComponentModel.DataAnnotations;
 | 
					using System.ComponentModel.DataAnnotations;
 | 
				
			||||||
 | 
					using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Employees.Db
 | 
					namespace DamageAssesment.Api.Employees.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("Employees")]
 | 
				
			||||||
    public class Employee
 | 
					    public class Employee
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										21
									
								
								DamageAssesmentApi/DamageAssesment.Api.Employees/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								DamageAssesmentApi/DamageAssesment.Api.Employees/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					EXPOSE 80
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 | 
				
			||||||
 | 
					WORKDIR /src
 | 
				
			||||||
 | 
					COPY ["DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj", "DamageAssesment.Api.Employees/"]
 | 
				
			||||||
 | 
					RUN dotnet restore "DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj"
 | 
				
			||||||
 | 
					COPY . .
 | 
				
			||||||
 | 
					WORKDIR "/src/DamageAssesment.Api.Employees"
 | 
				
			||||||
 | 
					RUN dotnet build "DamageAssesment.Api.Employees.csproj" -c Release -o /app/build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM build AS publish
 | 
				
			||||||
 | 
					RUN dotnet publish "DamageAssesment.Api.Employees.csproj" -c Release -o /app/publish /p:UseAppHost=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM base AS final
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					COPY --from=publish /app/publish .
 | 
				
			||||||
 | 
					ENTRYPOINT ["dotnet", "DamageAssesment.Api.Employees.dll"]
 | 
				
			||||||
@ -1,72 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Employees.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Employees.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(EmployeeDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230927210957_AzureEmployees")]
 | 
					 | 
				
			||||||
    partial class AzureEmployees
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Employees.Db.Employee", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("BirthDate")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Email")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("EmployeeCode")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Name")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("OfficePhoneNumber")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("PreferredLanguage")
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Employees");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,41 +0,0 @@
 | 
				
			|||||||
using System;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Employees.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class AzureEmployees : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "Employees",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    EmployeeCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
 | 
					 | 
				
			||||||
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
 | 
					 | 
				
			||||||
                    BirthDate = table.Column<DateTime>(type: "datetime2", nullable: false),
 | 
					 | 
				
			||||||
                    OfficePhoneNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
 | 
					 | 
				
			||||||
                    Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
 | 
					 | 
				
			||||||
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
 | 
					 | 
				
			||||||
                    PreferredLanguage = table.Column<string>(type: "nvarchar(max)", nullable: true)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_Employees", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "Employees");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,69 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Employees.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Employees.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(EmployeeDbContext))]
 | 
					 | 
				
			||||||
    partial class EmployeeDbContextModelSnapshot : ModelSnapshot
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        protected override void BuildModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Employees.Db.Employee", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<DateTime>("BirthDate")
 | 
					 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Email")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("EmployeeCode")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsActive")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Name")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("OfficePhoneNumber")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("PreferredLanguage")
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Employees");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,23 +1,14 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
					 | 
				
			||||||
  "iisSettings": {
 | 
					 | 
				
			||||||
    "windowsAuthentication": false,
 | 
					 | 
				
			||||||
    "anonymousAuthentication": true,
 | 
					 | 
				
			||||||
    "iisExpress": {
 | 
					 | 
				
			||||||
      "applicationUrl": "http://localhost:14425",
 | 
					 | 
				
			||||||
      "sslPort": 0
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "profiles": {
 | 
					  "profiles": {
 | 
				
			||||||
    "DamageAssesment.Api.Employees": {
 | 
					    "DamageAssesment.Api.Employees": {
 | 
				
			||||||
      "commandName": "Project",
 | 
					      "commandName": "Project",
 | 
				
			||||||
      "dotnetRunMessages": true,
 | 
					 | 
				
			||||||
      "launchBrowser": true,
 | 
					      "launchBrowser": true,
 | 
				
			||||||
      "launchUrl": "swagger",
 | 
					      "launchUrl": "swagger",
 | 
				
			||||||
      "applicationUrl": "http://localhost:5135",
 | 
					 | 
				
			||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      },
 | 
				
			||||||
 | 
					      "dotnetRunMessages": true,
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:5135"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "IIS Express": {
 | 
					    "IIS Express": {
 | 
				
			||||||
      "commandName": "IISExpress",
 | 
					      "commandName": "IISExpress",
 | 
				
			||||||
@ -26,6 +17,24 @@
 | 
				
			|||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "Docker": {
 | 
				
			||||||
 | 
					      "commandName": "Docker",
 | 
				
			||||||
 | 
					      "launchBrowser": true,
 | 
				
			||||||
 | 
					      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
 | 
				
			||||||
 | 
					      "environmentVariables": {
 | 
				
			||||||
 | 
					        "ASPNETCORE_URLS": "http://+:80"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "publishAllPorts": true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
				
			||||||
 | 
					  "iisSettings": {
 | 
				
			||||||
 | 
					    "windowsAuthentication": false,
 | 
				
			||||||
 | 
					    "anonymousAuthentication": true,
 | 
				
			||||||
 | 
					    "iisExpress": {
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:14425",
 | 
				
			||||||
 | 
					      "sslPort": 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -19,7 +19,7 @@ namespace DamageAssesment.Api.Employees.Providers
 | 
				
			|||||||
            this.EmployeeDbContext = EmployeeDbContext;
 | 
					            this.EmployeeDbContext = EmployeeDbContext;
 | 
				
			||||||
            this.logger = logger;
 | 
					            this.logger = logger;
 | 
				
			||||||
            this.mapper = mapper;
 | 
					            this.mapper = mapper;
 | 
				
			||||||
            // SeedData();
 | 
					          //  SeedData();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task<(bool IsSuccess, IEnumerable<Models.Employee> Employees, string ErrorMessage)> GetEmployeesAsync()
 | 
					        public async Task<(bool IsSuccess, IEnumerable<Models.Employee> Employees, string ErrorMessage)> GetEmployeesAsync()
 | 
				
			||||||
@ -77,7 +77,8 @@ namespace DamageAssesment.Api.Employees.Providers
 | 
				
			|||||||
                    EmployeeDbContext.Employees.Add(_employee);
 | 
					                    EmployeeDbContext.Employees.Add(_employee);
 | 
				
			||||||
                    Employee.Id = _employee.Id;
 | 
					                    Employee.Id = _employee.Id;
 | 
				
			||||||
                    EmployeeDbContext.SaveChanges();
 | 
					                    EmployeeDbContext.SaveChanges();
 | 
				
			||||||
                    return (true, Employee, null);
 | 
					                    //return (true, Employee, null);
 | 
				
			||||||
 | 
					                    return (true, mapper.Map<Db.Employee, Models.Employee>(_employee), null);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return (false, null, "Employee code is already exits");
 | 
					                return (false, null, "Employee code is already exits");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -156,12 +157,12 @@ namespace DamageAssesment.Api.Employees.Providers
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            if (!EmployeeDbContext.Employees.Any())
 | 
					            if (!EmployeeDbContext.Employees.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                EmployeeDbContext.Employees.Add(new Db.Employee() { EmployeeCode = "Emp1", Name = "ABC1", Email = "abc1@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-18), IsActive = true, PreferredLanguage = "en" });
 | 
					                EmployeeDbContext.Employees.Add(new Db.Employee() { EmployeeCode = "10101", Name = "David", Email = "david@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-18), IsActive = true, PreferredLanguage = "en" });
 | 
				
			||||||
                EmployeeDbContext.Employees.Add(new Db.Employee() { EmployeeCode = "Emp2", Name = "ABC2", Email = "abc2@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-22), IsActive = true, PreferredLanguage = "fr" });
 | 
					                EmployeeDbContext.Employees.Add(new Db.Employee() { EmployeeCode = "20202", Name = "Smith", Email = "smith@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-22), IsActive = true, PreferredLanguage = "fr" });
 | 
				
			||||||
                EmployeeDbContext.Employees.Add(new Db.Employee() { EmployeeCode = "Emp3", Name = "ABC3", Email = "abc3@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-30), IsActive = true, PreferredLanguage = "fr" });
 | 
					                //EmployeeDbContext.Employees.Add(new Db.Employee() { Id = 3, EmployeeCode = "Emp3", Name = "ABC3", Email = "abc3@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-30), IsActive = true, PreferredLanguage = "fr" });
 | 
				
			||||||
                EmployeeDbContext.Employees.Add(new Db.Employee() { EmployeeCode = "Emp4", Name = "ABC4", Email = "abc4@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-20), IsActive = true, PreferredLanguage = "en" });
 | 
					                //EmployeeDbContext.Employees.Add(new Db.Employee() { Id = 4, EmployeeCode = "Emp4", Name = "ABC4", Email = "abc4@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-20), IsActive = true, PreferredLanguage = "en" });
 | 
				
			||||||
                EmployeeDbContext.Employees.Add(new Db.Employee() { EmployeeCode = "Emp5", Name = "ABC5", Email = "abc5@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-23), IsActive = true, PreferredLanguage = "es" });
 | 
					                //EmployeeDbContext.Employees.Add(new Db.Employee() { Id = 5, EmployeeCode = "Emp5", Name = "ABC5", Email = "abc5@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-23), IsActive = true, PreferredLanguage = "es" });
 | 
				
			||||||
                EmployeeDbContext.Employees.Add(new Db.Employee() { EmployeeCode = "Emp6", Name = "ABC6", Email = "abc6@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-32), IsActive = true, PreferredLanguage = "es" });
 | 
					                //EmployeeDbContext.Employees.Add(new Db.Employee() { Id = 6, EmployeeCode = "Emp6", Name = "ABC6", Email = "abc6@gmail.com", OfficePhoneNumber = "12345678", BirthDate = DateTime.Now.AddYears(-32), IsActive = true, PreferredLanguage = "es" });
 | 
				
			||||||
                EmployeeDbContext.SaveChanges();
 | 
					                EmployeeDbContext.SaveChanges();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "Logging": {
 | 
					 | 
				
			||||||
    "LogLevel": {
 | 
					 | 
				
			||||||
      "Default": "Information",
 | 
					 | 
				
			||||||
      "Microsoft.AspNetCore": "Warning"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -10,6 +10,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "AllowedHosts": "*",
 | 
					  "AllowedHosts": "*",
 | 
				
			||||||
  "ConnectionStrings": {
 | 
					  "ConnectionStrings": {
 | 
				
			||||||
 | 
					    //"EmployeeConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
				
			||||||
    "EmployeeConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
					    "EmployeeConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@ namespace DamageAssesment.Api.Locations.Controllers
 | 
				
			|||||||
        /// Get all locations.
 | 
					        /// Get all locations.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Locations")]
 | 
					        [HttpGet("locations")]
 | 
				
			||||||
        public async Task<ActionResult> GetLocationsAsync()
 | 
					        public async Task<ActionResult> GetLocationsAsync()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -33,7 +33,7 @@ namespace DamageAssesment.Api.Locations.Controllers
 | 
				
			|||||||
        /// Get all locations based on locationdId.
 | 
					        /// Get all locations based on locationdId.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpGet("Locations/{id}")]
 | 
					        [HttpGet("locations/{id}")]
 | 
				
			||||||
        public async Task<ActionResult> GetLocationByIdAsync(int id)
 | 
					        public async Task<ActionResult> GetLocationByIdAsync(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -49,7 +49,7 @@ namespace DamageAssesment.Api.Locations.Controllers
 | 
				
			|||||||
        /// Update a Location.
 | 
					        /// Update a Location.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPut("Locations/{id}")]
 | 
					        [HttpPut("locations/{id}")]
 | 
				
			||||||
        public async Task<IActionResult> UpdateLocation(int id, Models.Location Location)
 | 
					        public async Task<IActionResult> UpdateLocation(int id, Models.Location Location)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (Location != null)
 | 
					            if (Location != null)
 | 
				
			||||||
@ -67,7 +67,7 @@ namespace DamageAssesment.Api.Locations.Controllers
 | 
				
			|||||||
        /// Save a new location.
 | 
					        /// Save a new location.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPost("Locations")]
 | 
					        [HttpPost("locations")]
 | 
				
			||||||
        public async Task<IActionResult> CreateLocation(Models.Location Location)
 | 
					        public async Task<IActionResult> CreateLocation(Models.Location Location)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (Location != null)
 | 
					            if (Location != null)
 | 
				
			||||||
@ -85,7 +85,7 @@ namespace DamageAssesment.Api.Locations.Controllers
 | 
				
			|||||||
        /// Delete an existing location.
 | 
					        /// Delete an existing location.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpDelete("Locations/{id}")]
 | 
					        [HttpDelete("locations/{id}")]
 | 
				
			||||||
        public async Task<IActionResult> DeleteLocation(int id)
 | 
					        public async Task<IActionResult> DeleteLocation(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.LocationProvider.DeleteLocationAsync(id);
 | 
					            var result = await this.LocationProvider.DeleteLocationAsync(id);
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,8 @@
 | 
				
			|||||||
    <Nullable>enable</Nullable>
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
					    <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
					    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
				
			||||||
 | 
					    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
 | 
				
			||||||
 | 
					    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
@ -23,6 +25,7 @@
 | 
				
			|||||||
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
 | 
					    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
 | 
				
			||||||
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
 | 
					    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
 | 
				
			||||||
    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
 | 
					    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
 | 
				
			||||||
 | 
					    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
 | 
				
			||||||
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
					    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Locations.Db
 | 
					namespace DamageAssesment.Api.Locations.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("Locations")]
 | 
				
			||||||
    public class Location
 | 
					    public class Location
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,9 @@
 | 
				
			|||||||
using System.ComponentModel.DataAnnotations;
 | 
					using System.ComponentModel.DataAnnotations;
 | 
				
			||||||
 | 
					using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Locations.Db
 | 
					namespace DamageAssesment.Api.Locations.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("Regions")]
 | 
				
			||||||
    public class Region
 | 
					    public class Region
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										21
									
								
								DamageAssesmentApi/DamageAssesment.Api.Locations/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								DamageAssesmentApi/DamageAssesment.Api.Locations/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					EXPOSE 80
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 | 
				
			||||||
 | 
					WORKDIR /src
 | 
				
			||||||
 | 
					COPY ["DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj", "DamageAssesment.Api.Locations/"]
 | 
				
			||||||
 | 
					RUN dotnet restore "DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj"
 | 
				
			||||||
 | 
					COPY . .
 | 
				
			||||||
 | 
					WORKDIR "/src/DamageAssesment.Api.Locations"
 | 
				
			||||||
 | 
					RUN dotnet build "DamageAssesment.Api.Locations.csproj" -c Release -o /app/build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM build AS publish
 | 
				
			||||||
 | 
					RUN dotnet publish "DamageAssesment.Api.Locations.csproj" -c Release -o /app/publish /p:UseAppHost=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM base AS final
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					COPY --from=publish /app/publish .
 | 
				
			||||||
 | 
					ENTRYPOINT ["dotnet", "DamageAssesment.Api.Locations.dll"]
 | 
				
			||||||
@ -1,88 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Locations.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Locations.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(LocationDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230927211146_AzureLocations")]
 | 
					 | 
				
			||||||
    partial class AzureLocations
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Location", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("LocationCode")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(4)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(4)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("MaintenanceCenter")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(4)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(4)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Name")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("RegionId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("SchoolType")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(2)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(2)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Locations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Region", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Abbreviation")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(5)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(5)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Name")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Regions");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,55 +0,0 @@
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Locations.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class AzureLocations : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "Locations",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    RegionId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    LocationCode = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
 | 
					 | 
				
			||||||
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
 | 
					 | 
				
			||||||
                    MaintenanceCenter = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
 | 
					 | 
				
			||||||
                    SchoolType = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_Locations", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "Regions",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
 | 
					 | 
				
			||||||
                    Abbreviation = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_Regions", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "Locations");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "Regions");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,85 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Locations.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Locations.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(LocationDbContext))]
 | 
					 | 
				
			||||||
    partial class LocationDbContextModelSnapshot : ModelSnapshot
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        protected override void BuildModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Location", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("LocationCode")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(4)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(4)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("MaintenanceCenter")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(4)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(4)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Name")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("RegionId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("SchoolType")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(2)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(2)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Locations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Region", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Abbreviation")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(5)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(5)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Name")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasMaxLength(50)
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(50)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Regions");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,23 +1,14 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
					 | 
				
			||||||
  "iisSettings": {
 | 
					 | 
				
			||||||
    "windowsAuthentication": false,
 | 
					 | 
				
			||||||
    "anonymousAuthentication": true,
 | 
					 | 
				
			||||||
    "iisExpress": {
 | 
					 | 
				
			||||||
      "applicationUrl": "http://localhost:20458",
 | 
					 | 
				
			||||||
      "sslPort": 0
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "profiles": {
 | 
					  "profiles": {
 | 
				
			||||||
    "DamageAssesment.Api.Locations": {
 | 
					    "DamageAssesment.Api.Locations": {
 | 
				
			||||||
      "commandName": "Project",
 | 
					      "commandName": "Project",
 | 
				
			||||||
      "dotnetRunMessages": true,
 | 
					 | 
				
			||||||
      "launchBrowser": true,
 | 
					      "launchBrowser": true,
 | 
				
			||||||
      "launchUrl": "swagger",
 | 
					      "launchUrl": "swagger",
 | 
				
			||||||
      "applicationUrl": "http://localhost:5213",
 | 
					 | 
				
			||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      },
 | 
				
			||||||
 | 
					      "dotnetRunMessages": true,
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:5213"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "IIS Express": {
 | 
					    "IIS Express": {
 | 
				
			||||||
      "commandName": "IISExpress",
 | 
					      "commandName": "IISExpress",
 | 
				
			||||||
@ -26,6 +17,24 @@
 | 
				
			|||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "Docker": {
 | 
				
			||||||
 | 
					      "commandName": "Docker",
 | 
				
			||||||
 | 
					      "launchBrowser": true,
 | 
				
			||||||
 | 
					      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
 | 
				
			||||||
 | 
					      "environmentVariables": {
 | 
				
			||||||
 | 
					        "ASPNETCORE_URLS": "http://+:80"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "publishAllPorts": true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
				
			||||||
 | 
					  "iisSettings": {
 | 
				
			||||||
 | 
					    "windowsAuthentication": false,
 | 
				
			||||||
 | 
					    "anonymousAuthentication": true,
 | 
				
			||||||
 | 
					    "iisExpress": {
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:20458",
 | 
				
			||||||
 | 
					      "sslPort": 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -17,7 +17,7 @@ namespace DamageAssesment.Api.Locations.Providers
 | 
				
			|||||||
            this.locationDbContext = locationDbContext;
 | 
					            this.locationDbContext = locationDbContext;
 | 
				
			||||||
            this.logger = logger;
 | 
					            this.logger = logger;
 | 
				
			||||||
            this.mapper = mapper;
 | 
					            this.mapper = mapper;
 | 
				
			||||||
            //SeedData();
 | 
					          //  SeedData();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task<(bool IsSuccess, IEnumerable<Models.Location> Locations, string ErrorMessage)> GetLocationsAsync()
 | 
					        public async Task<(bool IsSuccess, IEnumerable<Models.Location> Locations, string ErrorMessage)> GetLocationsAsync()
 | 
				
			||||||
@ -139,12 +139,13 @@ namespace DamageAssesment.Api.Locations.Providers
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            if (!locationDbContext.Locations.Any())
 | 
					            if (!locationDbContext.Locations.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "Loc1", RegionId = 1, Name = "BOB GRAHAM EDUCATION CENTER 1", MaintenanceCenter = "1", SchoolType = "US" });
 | 
					                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "0091", RegionId = 5, Name = "BOB GRAHAM EDUCATION CENTER", MaintenanceCenter = "1", SchoolType = "K8" });
 | 
				
			||||||
                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "Loc2", RegionId = 2, Name = "BOB GRAHAM EDUCATION CENTER 2", MaintenanceCenter = "1", SchoolType = "US" });
 | 
					                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "0092", RegionId = 1, Name = "NORMAN S. EDELCUP/SUNNY ISLES BEACH K-8", MaintenanceCenter = "1", SchoolType = "K8" });
 | 
				
			||||||
                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "Loc3", RegionId = 3, Name = "BOB GRAHAM EDUCATION CENTER 3", MaintenanceCenter = "1", SchoolType = "US" });
 | 
					                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "7511", RegionId = 4, Name = "MIAMI SPRINGS SHS", MaintenanceCenter = "2", SchoolType = "S" });
 | 
				
			||||||
                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "Loc4", RegionId = 1, Name = "BOB GRAHAM EDUCATION CENTER 4", MaintenanceCenter = "1", SchoolType = "US" });
 | 
					                //locationDbContext.Locations.Add(new Db.Location() { Id = 3, LocationCode = "Loc3", RegionId = 3, Name = "BOB GRAHAM EDUCATION CENTER 3", MaintenanceCenter = "1", SchoolType = "US" });
 | 
				
			||||||
                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "Loc5", RegionId = 2, Name = "BOB GRAHAM EDUCATION CENTER 5", MaintenanceCenter = "1", SchoolType = "US" });
 | 
					                //locationDbContext.Locations.Add(new Db.Location() { Id = 4, LocationCode = "Loc4", RegionId = 1, Name = "BOB GRAHAM EDUCATION CENTER 4", MaintenanceCenter = "1", SchoolType = "US" });
 | 
				
			||||||
                locationDbContext.Locations.Add(new Db.Location() { LocationCode = "Loc6", RegionId = 3, Name = "BOB GRAHAM EDUCATION CENTER 6", MaintenanceCenter = "1", SchoolType = "US" });
 | 
					                //locationDbContext.Locations.Add(new Db.Location() { Id = 5, LocationCode = "Loc5", RegionId = 2, Name = "BOB GRAHAM EDUCATION CENTER 5", MaintenanceCenter = "1", SchoolType = "US" });
 | 
				
			||||||
 | 
					                //locationDbContext.Locations.Add(new Db.Location() { Id = 6, LocationCode = "Loc6", RegionId = 3, Name = "BOB GRAHAM EDUCATION CENTER 6", MaintenanceCenter = "1", SchoolType = "US" });
 | 
				
			||||||
                locationDbContext.SaveChanges();
 | 
					                locationDbContext.SaveChanges();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@ namespace DamageAssesment.Api.Locations.Providers
 | 
				
			|||||||
            this.locationDbContext = regionDbContext;
 | 
					            this.locationDbContext = regionDbContext;
 | 
				
			||||||
            this.logger = logger;
 | 
					            this.logger = logger;
 | 
				
			||||||
            this.mapper = mapper;
 | 
					            this.mapper = mapper;
 | 
				
			||||||
            //SeedData();
 | 
					          //  SeedData();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task<(bool IsSuccess, Models.Region Region, string ErrorMessage)> GetRegionByIdAsync(int Id)
 | 
					        public async Task<(bool IsSuccess, Models.Region Region, string ErrorMessage)> GetRegionByIdAsync(int Id)
 | 
				
			||||||
@ -166,8 +166,10 @@ namespace DamageAssesment.Api.Locations.Providers
 | 
				
			|||||||
            if (!locationDbContext.Regions.Any())
 | 
					            if (!locationDbContext.Regions.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                locationDbContext.Regions.Add(new Db.Region() { Name = "North", Abbreviation = "N" });
 | 
					                locationDbContext.Regions.Add(new Db.Region() { Name = "North", Abbreviation = "N" });
 | 
				
			||||||
                locationDbContext.Regions.Add(new Db.Region() { Name = "South", Abbreviation = "S" });
 | 
					 | 
				
			||||||
                locationDbContext.Regions.Add(new Db.Region() { Name = "Central", Abbreviation = "C" });
 | 
					                locationDbContext.Regions.Add(new Db.Region() { Name = "Central", Abbreviation = "C" });
 | 
				
			||||||
 | 
					                locationDbContext.Regions.Add(new Db.Region() { Name = "South", Abbreviation = "S" });
 | 
				
			||||||
 | 
					                locationDbContext.Regions.Add(new Db.Region() { Name = "Charter Schools", Abbreviation = "CS" });
 | 
				
			||||||
 | 
					                locationDbContext.Regions.Add(new Db.Region() { Name = "Alternate and Special Centers", Abbreviation = "AC" });
 | 
				
			||||||
                locationDbContext.SaveChanges();
 | 
					                locationDbContext.SaveChanges();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "Logging": {
 | 
					 | 
				
			||||||
    "LogLevel": {
 | 
					 | 
				
			||||||
      "Default": "Information",
 | 
					 | 
				
			||||||
      "Microsoft.AspNetCore": "Warning"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -13,6 +13,7 @@
 | 
				
			|||||||
  //  "LocationConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
					  //  "LocationConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
				
			||||||
  //},
 | 
					  //},
 | 
				
			||||||
  "ConnectionStrings": {
 | 
					  "ConnectionStrings": {
 | 
				
			||||||
 | 
					    //"LocationConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
				
			||||||
    "LocationConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
					    "LocationConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -16,11 +16,10 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// GET request for retrieving questions.
 | 
					        /// GET request for retrieving questions.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        //get all questions
 | 
					        //get all questions
 | 
				
			||||||
        [Authorize(Roles = "admin,survey,user,report")]
 | 
					        [Authorize(Roles = "admin,survey,user,report")]
 | 
				
			||||||
        [Route("Questions")]
 | 
					        [Route("questions")]
 | 
				
			||||||
        [Route("Questions/{language:alpha}")]
 | 
					        [Route("questions/{language:alpha}")]
 | 
				
			||||||
        [HttpGet]
 | 
					        [HttpGet]
 | 
				
			||||||
        public async Task<IActionResult> GetQuestionsAsync(string? language)
 | 
					        public async Task<IActionResult> GetQuestionsAsync(string? language)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@ -37,8 +36,8 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// GET request for retrieving a question by ID.
 | 
					        /// GET request for retrieving a question by ID.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin,survey,user,report")]
 | 
					        [Authorize(Roles = "admin,survey,user,report")]
 | 
				
			||||||
        [Route("Questions/{id}/{language:alpha}")]
 | 
					        [Route("questions/{id}/{language:alpha}")]
 | 
				
			||||||
        [Route("Questions/{id:int}")]
 | 
					        [Route("questions/{id:int}")]
 | 
				
			||||||
        [HttpGet]
 | 
					        [HttpGet]
 | 
				
			||||||
        public async Task<IActionResult> GetQuestionByIdAsync(int id, string? language)
 | 
					        public async Task<IActionResult> GetQuestionByIdAsync(int id, string? language)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@ -56,8 +55,8 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// Uri: {Optional language}/GetSurveyQuestions/{surveyId} :Default returns question in all languages 
 | 
					        /// Uri: {Optional language}/GetSurveyQuestions/{surveyId} :Default returns question in all languages 
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin,survey,user,report")]
 | 
					        [Authorize(Roles = "admin,survey,user,report")]
 | 
				
			||||||
        [Route("Questions/BySurvey/{surveyId:int}")]
 | 
					        [Route("questions/bysurvey/{surveyId:int}")]
 | 
				
			||||||
        [Route("Questions/BySurvey/{surveyId:int}/{language:alpha}")]
 | 
					        [Route("questions/bysurvey/{surveyId:int}/{language:alpha}")]
 | 
				
			||||||
        [HttpGet]
 | 
					        [HttpGet]
 | 
				
			||||||
        public async Task<IActionResult> GetSurveyQuestions(int surveyId,string? language)
 | 
					        public async Task<IActionResult> GetSurveyQuestions(int surveyId,string? language)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@ -73,7 +72,7 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPut("Questions")]
 | 
					        [HttpPut("questions")]
 | 
				
			||||||
        public async Task<IActionResult> UpdateQuestion(Models.Question question)
 | 
					        public async Task<IActionResult> UpdateQuestion(Models.Question question)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (question != null)
 | 
					            if (question != null)
 | 
				
			||||||
@ -91,11 +90,32 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
            return CreatedAtRoute("DefaultApi", new { id = question.Id }, question);
 | 
					            return CreatedAtRoute("DefaultApi", new { id = question.Id }, question);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// POST request for creating a multiple question (multilingual).
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
 | 
					        [HttpPost("questions/multiple")]
 | 
				
			||||||
 | 
					        public async Task<IActionResult> CreateQuestions(List<Models.Question> questions)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (questions != null)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var result = await this.questionsProvider.PostQuestionsAsync(questions);
 | 
				
			||||||
 | 
					                if (result.IsSuccess)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    return Ok(result.Question);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (result.ErrorMessage == "Not Found")
 | 
				
			||||||
 | 
					                    return NotFound(result.ErrorMessage);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return BadRequest(result.ErrorMessage);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return CreatedAtRoute("DefaultApi", questions);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
        /// POST request for creating a new question (multilingual).
 | 
					        /// POST request for creating a new question (multilingual).
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPost("Questions")]
 | 
					        [HttpPost("questions")]
 | 
				
			||||||
        public async Task<IActionResult> CreateQuestion(Models.Question question)
 | 
					        public async Task<IActionResult> CreateQuestion(Models.Question question)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (question != null)
 | 
					            if (question != null)
 | 
				
			||||||
@ -114,7 +134,7 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpDelete("Questions/{id}")]
 | 
					        [HttpDelete("questions/{id}")]
 | 
				
			||||||
        public async Task<IActionResult> DeleteQuestion(int id)
 | 
					        public async Task<IActionResult> DeleteQuestion(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.questionsProvider.DeleteQuestionAsync(id);
 | 
					            var result = await this.questionsProvider.DeleteQuestionAsync(id);
 | 
				
			||||||
@ -130,8 +150,8 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Authorize(Roles = "admin,user,report")]
 | 
					        [Authorize(Roles = "admin,user,report")]
 | 
				
			||||||
        [HttpGet("Questions/Categories")]
 | 
					        [HttpGet("questions/categories")]
 | 
				
			||||||
        [HttpGet("Questions/Categories/{language:alpha}")]
 | 
					        [HttpGet("questions/categories/{language:alpha}")]
 | 
				
			||||||
        public async Task<IActionResult> GetQuestionCategoriesAsync(string? language)
 | 
					        public async Task<IActionResult> GetQuestionCategoriesAsync(string? language)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.questionsProvider.GetQuestionCategoriesAsync(language);
 | 
					            var result = await this.questionsProvider.GetQuestionCategoriesAsync(language);
 | 
				
			||||||
@ -145,8 +165,8 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// GET request for retrieving a question category by ID.
 | 
					        /// GET request for retrieving a question category by ID.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin,report")]
 | 
					        [Authorize(Roles = "admin,report")]
 | 
				
			||||||
        [HttpGet("Questions/Categories/{id:int}")]
 | 
					        [HttpGet("questions/categories/{id:int}")]
 | 
				
			||||||
        [HttpGet("Questions/Categories/{id:int}/{language:alpha}")]
 | 
					        [HttpGet("questions/categories/{id:int}/{language:alpha}")]
 | 
				
			||||||
        public async Task<IActionResult> GetQuestionCategoryAsync(int id,string? language)
 | 
					        public async Task<IActionResult> GetQuestionCategoryAsync(int id,string? language)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.questionsProvider.GetQuestionCategoryAsync(id, language);
 | 
					            var result = await this.questionsProvider.GetQuestionCategoryAsync(id, language);
 | 
				
			||||||
@ -162,7 +182,7 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// PUT request for updating a question category.
 | 
					        /// PUT request for updating a question category.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Authorize(Roles = "admin,survey,report")]
 | 
					        [Authorize(Roles = "admin,survey,report")]
 | 
				
			||||||
        [HttpPut("Questions/Categories")]
 | 
					        [HttpPut("questions/categories")]
 | 
				
			||||||
        public async Task<IActionResult> UpdateQuestionCategory(Models.QuestionCategory questionCategory)
 | 
					        public async Task<IActionResult> UpdateQuestionCategory(Models.QuestionCategory questionCategory)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (questionCategory != null)
 | 
					            if (questionCategory != null)
 | 
				
			||||||
@ -184,7 +204,7 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpPost("Questions/Categories")]
 | 
					        [HttpPost("questions/categories")]
 | 
				
			||||||
        public async Task<IActionResult> CreateQuestionCategory(Models.QuestionCategory questionCategory)
 | 
					        public async Task<IActionResult> CreateQuestionCategory(Models.QuestionCategory questionCategory)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (questionCategory != null)
 | 
					            if (questionCategory != null)
 | 
				
			||||||
@ -203,7 +223,7 @@ namespace DamageAssesment.Api.Questions.Controllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Authorize(Roles = "admin")]
 | 
					        [Authorize(Roles = "admin")]
 | 
				
			||||||
        [HttpDelete("Questions/Categories/{id}")]
 | 
					        [HttpDelete("questions/categories/{id}")]
 | 
				
			||||||
        public async Task<IActionResult> DeleteQuestionCategory(int id)
 | 
					        public async Task<IActionResult> DeleteQuestionCategory(int id)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = await this.questionsProvider.DeleteQuestionCategoryAsync(id);
 | 
					            var result = await this.questionsProvider.DeleteQuestionCategoryAsync(id);
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,8 @@
 | 
				
			|||||||
    <Nullable>enable</Nullable>
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
					    <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
					    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
				
			||||||
 | 
					    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
 | 
				
			||||||
 | 
					    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
@ -23,6 +25,7 @@
 | 
				
			|||||||
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
 | 
					    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
 | 
				
			||||||
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
 | 
					    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
 | 
				
			||||||
    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
 | 
					    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
 | 
				
			||||||
 | 
					    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
 | 
				
			||||||
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
					    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Questions.Db
 | 
					namespace DamageAssesment.Api.Questions.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("QuestionCategoryTrans")]
 | 
				
			||||||
    public class CategoryTranslation
 | 
					    public class CategoryTranslation
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Questions.Db
 | 
					namespace DamageAssesment.Api.Questions.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("Questions")]
 | 
				
			||||||
    public class Question
 | 
					    public class Question
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,10 @@
 | 
				
			|||||||
using System.Buffers.Text;
 | 
					using System.Buffers.Text;
 | 
				
			||||||
using System.ComponentModel.DataAnnotations;
 | 
					using System.ComponentModel.DataAnnotations;
 | 
				
			||||||
 | 
					using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Questions.Db
 | 
					namespace DamageAssesment.Api.Questions.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("QuestionCategories")]
 | 
				
			||||||
    public class QuestionCategory
 | 
					    public class QuestionCategory
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,9 @@
 | 
				
			|||||||
using System.ComponentModel.DataAnnotations;
 | 
					using System.ComponentModel.DataAnnotations;
 | 
				
			||||||
 | 
					using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Questions.Db
 | 
					namespace DamageAssesment.Api.Questions.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("QuestionTypes")]
 | 
				
			||||||
    public class QuestionType
 | 
					    public class QuestionType
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace DamageAssesment.Api.Questions.Db
 | 
					namespace DamageAssesment.Api.Questions.Db
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    [Table("QuestionTrans")]
 | 
				
			||||||
    public class QuestionsTranslation
 | 
					    public class QuestionsTranslation
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [Key]
 | 
					        [Key]
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										21
									
								
								DamageAssesmentApi/DamageAssesment.Api.Questions/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								DamageAssesmentApi/DamageAssesment.Api.Questions/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					EXPOSE 80
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 | 
				
			||||||
 | 
					WORKDIR /src
 | 
				
			||||||
 | 
					COPY ["DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj", "DamageAssesment.Api.Questions/"]
 | 
				
			||||||
 | 
					RUN dotnet restore "DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj"
 | 
				
			||||||
 | 
					COPY . .
 | 
				
			||||||
 | 
					WORKDIR "/src/DamageAssesment.Api.Questions"
 | 
				
			||||||
 | 
					RUN dotnet build "DamageAssesment.Api.Questions.csproj" -c Release -o /app/build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM build AS publish
 | 
				
			||||||
 | 
					RUN dotnet publish "DamageAssesment.Api.Questions.csproj" -c Release -o /app/publish /p:UseAppHost=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM base AS final
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					COPY --from=publish /app/publish .
 | 
				
			||||||
 | 
					ENTRYPOINT ["dotnet", "DamageAssesment.Api.Questions.dll"]
 | 
				
			||||||
@ -8,6 +8,7 @@ namespace DamageAssesment.Api.Questions.Interfaces
 | 
				
			|||||||
        Task<(bool IsSuccess, IEnumerable<Models.MultiLanguage> Questions, string ErrorMessage)> GetQuestionsAsync(string language);
 | 
					        Task<(bool IsSuccess, IEnumerable<Models.MultiLanguage> Questions, string ErrorMessage)> GetQuestionsAsync(string language);
 | 
				
			||||||
        Task<(bool IsSuccess, List<SurveyQuestions> SurveyQuestions, string ErrorMessage)> GetSurveyQuestionAsync(int surveyId,string language);
 | 
					        Task<(bool IsSuccess, List<SurveyQuestions> SurveyQuestions, string ErrorMessage)> GetSurveyQuestionAsync(int surveyId,string language);
 | 
				
			||||||
        Task<(bool IsSuccess, Models.MultiLanguage Question, string ErrorMessage)> PostQuestionAsync(Models.Question Question);
 | 
					        Task<(bool IsSuccess, Models.MultiLanguage Question, string ErrorMessage)> PostQuestionAsync(Models.Question Question);
 | 
				
			||||||
 | 
					        Task<(bool IsSuccess, IEnumerable<Models.MultiLanguage> Question, string ErrorMessage)> PostQuestionsAsync(List<Models.Question> Questions);
 | 
				
			||||||
        Task<(bool IsSuccess, Models.MultiLanguage Question, string ErrorMessage)> UpdateQuestionAsync(Models.Question Question);
 | 
					        Task<(bool IsSuccess, Models.MultiLanguage Question, string ErrorMessage)> UpdateQuestionAsync(Models.Question Question);
 | 
				
			||||||
        Task<(bool IsSuccess, Models.MultiLanguage Question, string ErrorMessage)> DeleteQuestionAsync(int id);
 | 
					        Task<(bool IsSuccess, Models.MultiLanguage Question, string ErrorMessage)> DeleteQuestionAsync(int id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,163 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Questions.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Questions.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(QuestionDbContext))]
 | 
					 | 
				
			||||||
    [Migration("20230927211340_AzureQuestions")]
 | 
					 | 
				
			||||||
    partial class AzureQuestions
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.CategoryTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CategoryId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Title")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("CategoryTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.Question", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CategoryId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("Comment")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsRequired")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("Key")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionNumber")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionTypeId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int?>("SurveyId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasIndex("QuestionTypeId");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Questions");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.QuestionCategory", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("IconLibrary")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("IconName")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("QuestionCategories");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.QuestionType", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("TypeText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("QuestionTypes");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.QuestionsTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("QuestionText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("QuestionsTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.Question", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.HasOne("DamageAssesment.Api.Questions.Db.QuestionType", "QuestionType")
 | 
					 | 
				
			||||||
                        .WithMany()
 | 
					 | 
				
			||||||
                        .HasForeignKey("QuestionTypeId")
 | 
					 | 
				
			||||||
                        .OnDelete(DeleteBehavior.Cascade)
 | 
					 | 
				
			||||||
                        .IsRequired();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Navigation("QuestionType");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,120 +0,0 @@
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Questions.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /// <inheritdoc />
 | 
					 | 
				
			||||||
    public partial class AzureQuestions : Migration
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "CategoryTranslations",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    CategoryId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    Language = table.Column<string>(type: "nvarchar(max)", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_CategoryTranslations", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "QuestionCategories",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    IconName = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    IconLibrary = table.Column<string>(type: "nvarchar(max)", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_QuestionCategories", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "QuestionsTranslations",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    QuestionId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    QuestionText = table.Column<string>(type: "nvarchar(max)", nullable: false),
 | 
					 | 
				
			||||||
                    Language = table.Column<string>(type: "nvarchar(max)", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_QuestionsTranslations", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "QuestionTypes",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    TypeText = table.Column<string>(type: "nvarchar(max)", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_QuestionTypes", x => x.Id);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					 | 
				
			||||||
                name: "Questions",
 | 
					 | 
				
			||||||
                columns: table => new
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                        .Annotation("SqlServer:Identity", "1, 1"),
 | 
					 | 
				
			||||||
                    QuestionTypeId = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    QuestionNumber = table.Column<int>(type: "int", nullable: false),
 | 
					 | 
				
			||||||
                    IsRequired = table.Column<bool>(type: "bit", nullable: false),
 | 
					 | 
				
			||||||
                    Comment = table.Column<bool>(type: "bit", nullable: false),
 | 
					 | 
				
			||||||
                    Key = table.Column<bool>(type: "bit", nullable: false),
 | 
					 | 
				
			||||||
                    SurveyId = table.Column<int>(type: "int", nullable: true),
 | 
					 | 
				
			||||||
                    CategoryId = table.Column<int>(type: "int", nullable: false)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                constraints: table =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    table.PrimaryKey("PK_Questions", x => x.Id);
 | 
					 | 
				
			||||||
                    table.ForeignKey(
 | 
					 | 
				
			||||||
                        name: "FK_Questions_QuestionTypes_QuestionTypeId",
 | 
					 | 
				
			||||||
                        column: x => x.QuestionTypeId,
 | 
					 | 
				
			||||||
                        principalTable: "QuestionTypes",
 | 
					 | 
				
			||||||
                        principalColumn: "Id",
 | 
					 | 
				
			||||||
                        onDelete: ReferentialAction.Cascade);
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.CreateIndex(
 | 
					 | 
				
			||||||
                name: "IX_Questions_QuestionTypeId",
 | 
					 | 
				
			||||||
                table: "Questions",
 | 
					 | 
				
			||||||
                column: "QuestionTypeId");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <inheritdoc />
 | 
					 | 
				
			||||||
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "CategoryTranslations");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "QuestionCategories");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "Questions");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "QuestionsTranslations");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					 | 
				
			||||||
                name: "QuestionTypes");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,160 +0,0 @@
 | 
				
			|||||||
// <auto-generated />
 | 
					 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using DamageAssesment.Api.Questions.Db;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#nullable disable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace DamageAssesment.Api.Questions.Migrations
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [DbContext(typeof(QuestionDbContext))]
 | 
					 | 
				
			||||||
    partial class QuestionDbContextModelSnapshot : ModelSnapshot
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        protected override void BuildModel(ModelBuilder modelBuilder)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
#pragma warning disable 612, 618
 | 
					 | 
				
			||||||
            modelBuilder
 | 
					 | 
				
			||||||
                .HasAnnotation("ProductVersion", "7.0.9")
 | 
					 | 
				
			||||||
                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.CategoryTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CategoryId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Title")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("CategoryTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.Question", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("CategoryId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("Comment")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("IsRequired")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<bool>("Key")
 | 
					 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionNumber")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionTypeId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int?>("SurveyId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasIndex("QuestionTypeId");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("Questions");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.QuestionCategory", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("IconLibrary")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("IconName")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("QuestionCategories");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.QuestionType", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("TypeText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("QuestionTypes");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.QuestionsTranslation", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.Property<int>("Id")
 | 
					 | 
				
			||||||
                        .ValueGeneratedOnAdd()
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Language")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<int>("QuestionId")
 | 
					 | 
				
			||||||
                        .HasColumnType("int");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("QuestionText")
 | 
					 | 
				
			||||||
                        .IsRequired()
 | 
					 | 
				
			||||||
                        .HasColumnType("nvarchar(max)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.HasKey("Id");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.ToTable("QuestionsTranslations");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            modelBuilder.Entity("DamageAssesment.Api.Questions.Db.Question", b =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    b.HasOne("DamageAssesment.Api.Questions.Db.QuestionType", "QuestionType")
 | 
					 | 
				
			||||||
                        .WithMany()
 | 
					 | 
				
			||||||
                        .HasForeignKey("QuestionTypeId")
 | 
					 | 
				
			||||||
                        .OnDelete(DeleteBehavior.Cascade)
 | 
					 | 
				
			||||||
                        .IsRequired();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Navigation("QuestionType");
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
#pragma warning restore 612, 618
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -5,6 +5,7 @@
 | 
				
			|||||||
        public int CategoryId { get; set; }
 | 
					        public int CategoryId { get; set; }
 | 
				
			||||||
        public string IconName { get; set; }
 | 
					        public string IconName { get; set; }
 | 
				
			||||||
        public string IconLibrary { get; set; }
 | 
					        public string IconLibrary { get; set; }
 | 
				
			||||||
 | 
					        public object CategoryNames { get; set; }
 | 
				
			||||||
        public List<MultiLanguage> QuestionsText { get; set; }
 | 
					        public List<MultiLanguage> QuestionsText { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,23 +1,14 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
					 | 
				
			||||||
  "iisSettings": {
 | 
					 | 
				
			||||||
    "windowsAuthentication": false,
 | 
					 | 
				
			||||||
    "anonymousAuthentication": true,
 | 
					 | 
				
			||||||
    "iisExpress": {
 | 
					 | 
				
			||||||
      "applicationUrl": "http://localhost:60754",
 | 
					 | 
				
			||||||
      "sslPort": 0
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "profiles": {
 | 
					  "profiles": {
 | 
				
			||||||
    "DamageAssesment.Api.Questions": {
 | 
					    "DamageAssesment.Api.Questions": {
 | 
				
			||||||
      "commandName": "Project",
 | 
					      "commandName": "Project",
 | 
				
			||||||
      "dotnetRunMessages": true,
 | 
					 | 
				
			||||||
      "launchBrowser": true,
 | 
					      "launchBrowser": true,
 | 
				
			||||||
      "launchUrl": "swagger",
 | 
					      "launchUrl": "swagger",
 | 
				
			||||||
      "applicationUrl": "http://localhost:5133",
 | 
					 | 
				
			||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      },
 | 
				
			||||||
 | 
					      "dotnetRunMessages": true,
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:5133"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "IIS Express": {
 | 
					    "IIS Express": {
 | 
				
			||||||
      "commandName": "IISExpress",
 | 
					      "commandName": "IISExpress",
 | 
				
			||||||
@ -26,6 +17,24 @@
 | 
				
			|||||||
      "environmentVariables": {
 | 
					      "environmentVariables": {
 | 
				
			||||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
					        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "Docker": {
 | 
				
			||||||
 | 
					      "commandName": "Docker",
 | 
				
			||||||
 | 
					      "launchBrowser": true,
 | 
				
			||||||
 | 
					      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
 | 
				
			||||||
 | 
					      "environmentVariables": {
 | 
				
			||||||
 | 
					        "ASPNETCORE_URLS": "http://+:80"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "publishAllPorts": true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "$schema": "https://json.schemastore.org/launchsettings.json",
 | 
				
			||||||
 | 
					  "iisSettings": {
 | 
				
			||||||
 | 
					    "windowsAuthentication": false,
 | 
				
			||||||
 | 
					    "anonymousAuthentication": true,
 | 
				
			||||||
 | 
					    "iisExpress": {
 | 
				
			||||||
 | 
					      "applicationUrl": "http://localhost:60754",
 | 
				
			||||||
 | 
					      "sslPort": 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -19,21 +19,11 @@ namespace DamageAssesment.Api.Questions.Providers
 | 
				
			|||||||
            this.questionDbContext = questionDbContext;
 | 
					            this.questionDbContext = questionDbContext;
 | 
				
			||||||
            this.logger = logger;
 | 
					            this.logger = logger;
 | 
				
			||||||
            this.mapper = mapper;
 | 
					            this.mapper = mapper;
 | 
				
			||||||
            //SeedData();
 | 
					           // SeedData();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void SeedData()
 | 
					        public void SeedData()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (!questionDbContext.QuestionCategories.Any())
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Electrical", IconLibrary = "img1" });
 | 
					 | 
				
			||||||
                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Flooding", IconLibrary = "img1" });
 | 
					 | 
				
			||||||
                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Structural", IconLibrary = "img1" });
 | 
					 | 
				
			||||||
                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Utility", IconLibrary = "img1" });
 | 
					 | 
				
			||||||
                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Debris", IconLibrary = "img1" });
 | 
					 | 
				
			||||||
                questionDbContext.SaveChanges();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (!questionDbContext.QuestionTypes.Any())
 | 
					            if (!questionDbContext.QuestionTypes.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                questionDbContext.QuestionTypes.Add(new Db.QuestionType() { TypeText = "RadioButton" });
 | 
					                questionDbContext.QuestionTypes.Add(new Db.QuestionType() { TypeText = "RadioButton" });
 | 
				
			||||||
@ -41,30 +31,18 @@ namespace DamageAssesment.Api.Questions.Providers
 | 
				
			|||||||
                questionDbContext.QuestionTypes.Add(new Db.QuestionType() { TypeText = "TextBox" });
 | 
					                questionDbContext.QuestionTypes.Add(new Db.QuestionType() { TypeText = "TextBox" });
 | 
				
			||||||
                questionDbContext.SaveChanges();
 | 
					                questionDbContext.SaveChanges();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (!questionDbContext.Questions.Any())
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                questionDbContext.Questions.Add(new Db.Question() { QuestionTypeId = 2, SurveyId = 1, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId=1 });
 | 
					 | 
				
			||||||
                questionDbContext.Questions.Add(new Db.Question() { QuestionTypeId = 3, SurveyId = 1, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 1 });
 | 
					 | 
				
			||||||
                questionDbContext.Questions.Add(new Db.Question() { QuestionTypeId = 1, SurveyId = 1, QuestionNumber = 3, IsRequired = true, Comment = false, Key = true,  CategoryId = 2 });
 | 
					 | 
				
			||||||
                questionDbContext.SaveChanges();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (!questionDbContext.QuestionsTranslations.Any())
 | 
					            if (!questionDbContext.QuestionsTranslations.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 1, QuestionText = "Can You Open ?", Language = "en" });
 | 
					                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Flooding", IconLibrary = "https://example.com/images/img1.png" });
 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 1, QuestionText = "Peux-tu ouvrir ?", Language = "fr" });
 | 
					                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Electrical", IconLibrary = "https://example.com/images/img2.png" });
 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 2, QuestionText = "Are the grounds flodded ?", Language = "en" });
 | 
					                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Structural", IconLibrary = "https://example.com/images/img3.png" });
 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 2, QuestionText = "Les terrains sont-ils inondés ?", Language = "fr" });
 | 
					                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Utility", IconLibrary = "https://example.com/images/img4.png" });
 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 3, QuestionText = "Is the access blocked by flooding ?", Language = "en" });
 | 
					                questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Debris", IconLibrary = "https://example.com/images/img5.png" });
 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 3, QuestionText = "L'accès est-il bloqué par les inondations ?", Language = "fr" });
 | 
					 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 1, QuestionText = "Puedes abrir ?", Language = "sp" });
 | 
					 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 2, QuestionText = "¿Están inundados los terrenos?", Language = "sp" });
 | 
					 | 
				
			||||||
                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 3, QuestionText = "¿El acceso está bloqueado por inundaciones?", Language = "sp" });
 | 
					 | 
				
			||||||
                questionDbContext.SaveChanges();
 | 
					                questionDbContext.SaveChanges();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!questionDbContext.CategoryTranslations.Any())
 | 
					            if (!questionDbContext.CategoryTranslations.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                questionDbContext.CategoryTranslations.Add(new Db.CategoryTranslation() { CategoryId = 1, Title = "Flooding", Language = "en" });
 | 
					                questionDbContext.CategoryTranslations.Add(new Db.CategoryTranslation() { CategoryId = 1, Title = "Flooding", Language = "en" });
 | 
				
			||||||
                questionDbContext.CategoryTranslations.Add(new Db.CategoryTranslation() { CategoryId = 2, Title = "Electrical", Language = "en" });
 | 
					                questionDbContext.CategoryTranslations.Add(new Db.CategoryTranslation() { CategoryId = 2, Title = "Electrical", Language = "en" });
 | 
				
			||||||
                questionDbContext.CategoryTranslations.Add(new Db.CategoryTranslation() { CategoryId = 3, Title = "Structural", Language = "en" });
 | 
					                questionDbContext.CategoryTranslations.Add(new Db.CategoryTranslation() { CategoryId = 3, Title = "Structural", Language = "en" });
 | 
				
			||||||
@ -82,6 +60,132 @@ namespace DamageAssesment.Api.Questions.Providers
 | 
				
			|||||||
                questionDbContext.CategoryTranslations.Add(new Db.CategoryTranslation() { CategoryId = 5, Title = "Escombros", Language = "es" });
 | 
					                questionDbContext.CategoryTranslations.Add(new Db.CategoryTranslation() { CategoryId = 5, Title = "Escombros", Language = "es" });
 | 
				
			||||||
                questionDbContext.SaveChanges();
 | 
					                questionDbContext.SaveChanges();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (!questionDbContext.Questions.Any())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var question1 = new Db.Question() { QuestionTypeId = 1, SurveyId = 1, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
 | 
				
			||||||
 | 
					                var question2 = new Db.Question() { QuestionTypeId = 1, SurveyId = 1, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 2 };
 | 
				
			||||||
 | 
					                var question3 = new Db.Question() { QuestionTypeId = 1, SurveyId = 2, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
 | 
				
			||||||
 | 
					                var question4 = new Db.Question() { QuestionTypeId = 1, SurveyId = 2, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 2 };
 | 
				
			||||||
 | 
					                var question5 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
 | 
				
			||||||
 | 
					                var question6 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 2 };
 | 
				
			||||||
 | 
					                var question7 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 3};
 | 
				
			||||||
 | 
					                var question8 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 4 };
 | 
				
			||||||
 | 
					                var question9 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = true, Key = true, CategoryId = 5 };
 | 
				
			||||||
 | 
					                var question10 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = false, Key = true, CategoryId = 1 };
 | 
				
			||||||
 | 
					                var question11 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = false, CategoryId = 2 };
 | 
				
			||||||
 | 
					                var question12 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = true, CategoryId = 3 };
 | 
				
			||||||
 | 
					                var question13 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 4 };
 | 
				
			||||||
 | 
					                var question14 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 5 };
 | 
				
			||||||
 | 
					                var question15 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = false, CategoryId = 1 };
 | 
				
			||||||
 | 
					                var question16 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = true, CategoryId = 2 };
 | 
				
			||||||
 | 
					                var question17 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = false, CategoryId = 3 };
 | 
				
			||||||
 | 
					                var question18 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 4 };
 | 
				
			||||||
 | 
					                var question19 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 5 };
 | 
				
			||||||
 | 
					                var question20 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 1 };
 | 
				
			||||||
 | 
					                var question21 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 2 };
 | 
				
			||||||
 | 
					                var question22 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = true, CategoryId = 3 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question1);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question2);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question3);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question4);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question5);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question6);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question7);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question8);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question9);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question10);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question11);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question12);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question13);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question14);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question15);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question16);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question17);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question18);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question19);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question20);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question21);
 | 
				
			||||||
 | 
					                questionDbContext.Questions.Add(question22);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                questionDbContext.SaveChanges();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (!questionDbContext.QuestionsTranslations.Any())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 1, QuestionText = "Can You Open ?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 1, QuestionText = "Peux-tu ouvrir ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 1, QuestionText = "Puedes abrir ?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 2, QuestionText = "Are the grounds flooded ?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 2, QuestionText = "Les terrains sont-ils inondés ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 2, QuestionText = "¿Están inundados los terrenos?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 3, QuestionText = "Is the access blocked by flooding ?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 3, QuestionText = "L'accès est-il bloqué par les inondations ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 3, QuestionText = "¿El acceso está bloqueado por inundaciones?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "Are the grounds flooded ?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "Les terrains sont-ils inondés ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "¿Están inundados los terrenos?", Language = "es" });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 5, QuestionText = "Can you open?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 6, QuestionText = "Is debris blocking access?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 7, QuestionText = "Are the grounds flooded?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 8, QuestionText = "Is the access blocked by flooding?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 9, QuestionText = "Are any utility wires down?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 10, QuestionText = "Do you have damage to windows, doors, or walls?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 11, QuestionText = "Do you have roof damage?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 12, QuestionText = "Do you have major water intrusion?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 13, QuestionText = "Are any portable classrooms damaged and unusable?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 14, QuestionText = "Does your facility need to be secured/boarded?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 15, QuestionText = "Are you without commercial power?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 16, QuestionText = "Are you without water pressure?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 17, QuestionText = "Are you without telephones?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 18, QuestionText = "Are traffic signals damaged/missing?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 19, QuestionText = "Are you without an operable fire alarm?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 20, QuestionText = "Are you without an operable public address?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 21, QuestionText = "Do you have major debris?", Language = "en" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 22, QuestionText = "Are there any problems or issues not addressed above that would impede you from opening? If yes, please explain below?", Language = "en" });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 5, QuestionText = "Pouvez-vous ouvrir ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 6, QuestionText = "Est-ce que des débris bloquent l'accès ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 7, QuestionText = "Les terrains sont-ils inondés ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 8, QuestionText = "L'accès est-il bloqué par des inondations ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 9, QuestionText = "Des câbles d'utilité sont-ils tombés ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 10, QuestionText = "Avez-vous des dommages aux fenêtres, portes ou murs ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 11, QuestionText = "Avez-vous des dommages au toit ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 12, QuestionText = "Avez-vous une intrusion d'eau majeure ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 13, QuestionText = "Les salles de classe portables sont-elles endommagées et inutilisables ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 14, QuestionText = "Votre établissement a-t-il besoin d'être sécurisé/protégé ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 15, QuestionText = "Êtes-vous sans alimentation électrique commerciale ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 16, QuestionText = "Êtes-vous sans pression d'eau ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 17, QuestionText = "Êtes-vous sans téléphones ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 18, QuestionText = "Les feux de circulation sont-ils endommagés/absents ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 19, QuestionText = "N'avez-vous pas d'alarme incendie fonctionnelle ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 20, QuestionText = "N'avez-vous pas de système de sonorisation opérationnel ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 21, QuestionText = "Avez-vous une grande quantité de débris ?", Language = "fr" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 22, QuestionText = "Y a-t-il des problèmes ou des problèmes non abordés ci-dessus qui vous empêcheraient d'ouvrir ? Si oui, veuillez expliquer ci-dessous.", Language = "fr" });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 5, QuestionText = "¿Puedes abrir ?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 6, QuestionText = "¿Los escombros bloquean el acceso?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 7, QuestionText = "¿Están inundados los terrenos?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 8, QuestionText = "¿El acceso está bloqueado por inundaciones?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 9, QuestionText = "¿Hay cables de utilidad caídos?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 10, QuestionText = "¿Tienes daños en ventanas, puertas o paredes?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 11, QuestionText = "¿Tienes daños en el techo?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 12, QuestionText = "¿Tienes una gran intrusión de agua?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 13, QuestionText = "¿Hay aulas portátiles dañadas e inutilizables?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 14, QuestionText = "¿Tu instalación necesita ser asegurada/tabicada?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 15, QuestionText = "¿No tienes energía comercial?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 16, QuestionText = "¿No tienes presión de agua?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 17, QuestionText = "¿No tienes teléfonos?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 18, QuestionText = "¿Los semáforos están dañados/faltan?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 19, QuestionText = "¿No tienes una alarma de incendios operativa?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 20, QuestionText = "¿No tienes un sistema de megafonía operativo?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 21, QuestionText = "¿Tienes una gran cantidad de escombros?", Language = "es" });
 | 
				
			||||||
 | 
					                questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 22, QuestionText = "¿Hay algún problema o asunto no abordado anteriormente que le impida abrir? Si es así, por favor explíquelo a continuación.", Language = "es" });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                questionDbContext.SaveChanges();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public List<Models.CategoryTranslation> GetCategoryTranslations(int id, string? language)
 | 
					        public List<Models.CategoryTranslation> GetCategoryTranslations(int id, string? language)
 | 
				
			||||||
@ -209,6 +313,7 @@ namespace DamageAssesment.Api.Questions.Providers
 | 
				
			|||||||
                            CategoryId = item.Id,
 | 
					                            CategoryId = item.Id,
 | 
				
			||||||
                            IconLibrary = item.IconLibrary,
 | 
					                            IconLibrary = item.IconLibrary,
 | 
				
			||||||
                            IconName = item.IconName,
 | 
					                            IconName = item.IconName,
 | 
				
			||||||
 | 
					                            CategoryNames= CreateCategoryMultiLanguageObject(GetCategoryTranslations(item.Id, language)),
 | 
				
			||||||
                            QuestionsText = GetSurveyQuestion(mapper.Map<List<Db.Question>, List<Models.MultiLanguage>>(questions.Where(a => a.CategoryId == item.Id).ToList()), language)
 | 
					                            QuestionsText = GetSurveyQuestion(mapper.Map<List<Db.Question>, List<Models.MultiLanguage>>(questions.Where(a => a.CategoryId == item.Id).ToList()), language)
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -229,16 +334,7 @@ namespace DamageAssesment.Api.Questions.Providers
 | 
				
			|||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                logger?.LogInformation("Query Question");
 | 
					                logger?.LogInformation("Query Question");
 | 
				
			||||||
                var dbquestion = mapper.Map<Models.Question, Db.Question>(Question);
 | 
					                var result = InsertQuestion(Question);
 | 
				
			||||||
                var dbquestiontranslation = mapper.Map<List<Models.QuestionsTranslation>, List<Db.QuestionsTranslation>>(Question.Questions);
 | 
					 | 
				
			||||||
                dbquestion.QuestionTypeId = questionDbContext.QuestionTypes.Where(a => a.TypeText == Question.TypeText).Select(a => a.Id).FirstOrDefault();
 | 
					 | 
				
			||||||
                questionDbContext.Questions.Add(dbquestion);
 | 
					 | 
				
			||||||
                dbquestiontranslation.ForEach(i => i.QuestionId = dbquestion.Id);
 | 
					 | 
				
			||||||
                questionDbContext.QuestionsTranslations.AddRange(dbquestiontranslation);
 | 
					 | 
				
			||||||
                questionDbContext.SaveChanges();
 | 
					 | 
				
			||||||
                Question.Id = dbquestion.Id;
 | 
					 | 
				
			||||||
                var result = mapper.Map<Db.Question, Models.MultiLanguage>(dbquestion);
 | 
					 | 
				
			||||||
                result.Text = CreateMultiLanguageObject(GetQuestionsTranslations(result.Id,""));
 | 
					 | 
				
			||||||
                return (true, result, null);
 | 
					                return (true, result, null);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
@ -247,6 +343,39 @@ namespace DamageAssesment.Api.Questions.Providers
 | 
				
			|||||||
                return (false, null, ex.Message);
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        private Models.MultiLanguage InsertQuestion(Models.Question Question)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var dbquestion = mapper.Map<Models.Question, Db.Question>(Question);
 | 
				
			||||||
 | 
					            var dbquestiontranslation = mapper.Map<List<Models.QuestionsTranslation>, List<Db.QuestionsTranslation>>(Question.Questions);
 | 
				
			||||||
 | 
					            dbquestion.QuestionTypeId = questionDbContext.QuestionTypes.Where(a => a.TypeText == Question.TypeText).Select(a => a.Id).FirstOrDefault();
 | 
				
			||||||
 | 
					            questionDbContext.Questions.Add(dbquestion);
 | 
				
			||||||
 | 
					            questionDbContext.SaveChanges();
 | 
				
			||||||
 | 
					            dbquestiontranslation.ForEach(i => i.QuestionId = dbquestion.Id);
 | 
				
			||||||
 | 
					            questionDbContext.QuestionsTranslations.AddRange(dbquestiontranslation);
 | 
				
			||||||
 | 
					            questionDbContext.SaveChanges();
 | 
				
			||||||
 | 
					            Question.Id = dbquestion.Id;
 | 
				
			||||||
 | 
					            var result = mapper.Map<Db.Question, Models.MultiLanguage>(dbquestion);
 | 
				
			||||||
 | 
					            result.Text = CreateMultiLanguageObject(GetQuestionsTranslations(result.Id, ""));
 | 
				
			||||||
 | 
					            return result;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public async Task<(bool IsSuccess, IEnumerable<Models.MultiLanguage> Question, string ErrorMessage)> PostQuestionsAsync(List<Models.Question> Questions)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                List<Models.MultiLanguage> results = new List<MultiLanguage>();
 | 
				
			||||||
 | 
					                logger?.LogInformation("Query Question");
 | 
				
			||||||
 | 
					                foreach (Models.Question Question in Questions)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    results.Add(InsertQuestion(Question));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return (true, results, null);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                logger?.LogError(ex.ToString());
 | 
				
			||||||
 | 
					                return (false, null, ex.Message);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        public async Task<(bool IsSuccess, Models.MultiLanguage Question, string ErrorMessage)> UpdateQuestionAsync(Models.Question Question)
 | 
					        public async Task<(bool IsSuccess, Models.MultiLanguage Question, string ErrorMessage)> UpdateQuestionAsync(Models.Question Question)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "Logging": {
 | 
					 | 
				
			||||||
    "LogLevel": {
 | 
					 | 
				
			||||||
      "Default": "Information",
 | 
					 | 
				
			||||||
      "Microsoft.AspNetCore": "Warning"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -9,10 +9,8 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "AllowedHosts": "*",
 | 
					  "AllowedHosts": "*",
 | 
				
			||||||
  //"ConnectionStrings": {
 | 
					 | 
				
			||||||
  //  "QuestionConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
					 | 
				
			||||||
  //},
 | 
					 | 
				
			||||||
  "ConnectionStrings": {
 | 
					  "ConnectionStrings": {
 | 
				
			||||||
 | 
					    //"QuestionConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
 | 
				
			||||||
    "QuestionConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
					    "QuestionConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user