Skip to content

answer BE from Akbar #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vs/PlsAPI/DesignTimeBuild/.dtbcache
Binary file not shown.
Binary file added .vs/PlsAPI/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
1,001 changes: 1,001 additions & 0 deletions .vs/PlsAPI/config/applicationhost.config

Large diffs are not rendered by default.

Binary file added .vs/PlsAPI/v16/.suo
Binary file not shown.
Empty file.
Binary file added .vs/PlsAPI/v16/Server/sqlite3/storage.ide
Binary file not shown.
Binary file added .vs/PlsAPI/v16/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file added .vs/PlsAPI/v16/Server/sqlite3/storage.ide-wal
Binary file not shown.
6 changes: 6 additions & 0 deletions Controllers/IEnumerable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace PlsAPI.Controllers
{
public interface IEnumerable<T1, T2>
{
}
}
55 changes: 55 additions & 0 deletions Controllers/OneController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace PlsAPI.Controllers
{
[Route("backend/question/[controller]")]
[ApiController]
public class OneController : ControllerBase
{
// GET: backend/question/<OneController>
[HttpGet]
public IEnumerable<PlsAPI.Models.One> Get()
{
return Enumerable.Range(1, 1).Select(index => new PlsAPI.Models.One
{
id = 523329,
title = "Rustic Steel Salad",
description = "Carbonite web goalkeeper gloves are ergonomically designed to give easy fit",
footer = "Ergonomic",
createdAt = "2021-06-28T17:56:03.7396771+00:00"
})
.ToArray();
}

// GET api/<OneController>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}

// POST api/<OneController>
[HttpPost]
public void Post([FromBody] string value)
{
}

// PUT api/<OneController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}

// DELETE api/<OneController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
56 changes: 56 additions & 0 deletions Controllers/ThreeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace PlsAPI.Controllers
{
[Route("backend/question/[controller]")]
[ApiController]
public class ThreeController : ControllerBase
{
// GET: backend/question/<ThreeController>
[HttpGet]
public IEnumerable<PlsAPI.Models.Three> Get()
{
var rng = new Random();
var no = new Random();
int last = 3;
return Enumerable.Range(0, 4).Select(index => new PlsAPI.Models.Three
{
id = index,
category = "",
items = "",
createdAt = DateTime.Now.AddDays(index)
}).Reverse().ToArray();
}

// GET api/<ThreeController>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}

// POST api/<ThreeController>
[HttpPost]
public void Post([FromBody] string value)
{
}

// PUT api/<ThreeController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}

// DELETE api/<ThreeController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
80 changes: 80 additions & 0 deletions Controllers/TwoController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace PlsAPI.Controllers
{
[Route("backend/question/[controller]")]
[ApiController]
public class TwoController : ControllerBase
{
private static readonly int[] ids = new[]
{
1, 2, 3, 4, 5
};

private static readonly string[] titles = new[]
{
"Rainy", "Warm", "Ergonomics", "Hot", "Sweltering"
};

private static readonly string[] tags = new[]
{
"Working", "Launch", "Sports", "Singing", "Teaching"
};

// GET: api/<TwoController>
[HttpGet]
public IEnumerable<PlsAPI.Models.Two> Get()
{
var rng = new Random();
var no = new Random();
int last = 3;
return Enumerable.Range(0, 4).Select(index => new PlsAPI.Models.Two
{
id = ids[index],
title = titles[index], //titles[rng.Next(titles.Length)],
tag = tags[index],
createdAt = DateTime.Now.AddDays(index)
}).Reverse().ToArray();
}

// GET api/<TwoController>/5
[HttpGet("{id}")]
public IEnumerable<PlsAPI.Models.Two> Get(int id)
{
var rng = new Random();
var no = new Random();
int last = id;
return Enumerable.Range(0, last).Select(index => new PlsAPI.Models.Two
{
id = ids[index],
title = titles[index],
tag = tags[index],
createdAt = DateTime.Now.AddDays(index)
}).Reverse().ToArray();
}

// POST api/<TwoController>
[HttpPost]
public void Post([FromBody] string value)
{
}

// PUT api/<TwoController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}

// DELETE api/<TwoController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
31 changes: 31 additions & 0 deletions Models/CCAIContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using System.Data.SqlClient;
using Microsoft.Data.SqlClient;

namespace PlsAPI.Models
{
public partial class CCAIContext : DbContext
{
public CCAIContext(DbContextOptions<CCAIContext> options)
: base(options)
{
}

public virtual DbSet<One> One { get; set; }
public virtual DbSet<Two> Two { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{

}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{

}

partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
}
16 changes: 16 additions & 0 deletions Models/One.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace PlsAPI.Models
{
public class One
{
public long id { get; set; }
public string title { get; set; }
public string description { get; set; }
public string footer { get; set; }
public string createdAt { get; set; }
}
}
32 changes: 32 additions & 0 deletions Models/Three.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace PlsAPI.Models
{
public class Three
{
public long id { get; set; }
public string category { get; set; }
public string items { get; set; }
public DateTime createdAt { get; set; }
}

public partial class itemsData
{
public string title { get; set; }
public string description { get; set; }
public string footer { get; set; }
}

public partial class itemsOut
{
public long id { get; set; }
public int category { get; set; }
public string title { get; set; }
public string description { get; set; }
public string footer { get; set; }
public DateTime createdAt { get; set; }
}
}
15 changes: 15 additions & 0 deletions Models/Two.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace PlsAPI.Models
{
public class Two
{
public long id { get; set; }
public string title { get; set; }
public string tag { get; set; }
public DateTime createdAt { get; set; }
}
}
26 changes: 26 additions & 0 deletions PlsAPI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
</ItemGroup>


</Project>
17 changes: 17 additions & 0 deletions PlsAPI.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Controller_SelectedScaffolderID>ApiControllerWithActionsScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
<WebStackScaffolding_DbContextDialogWidth>600</WebStackScaffolding_DbContextDialogWidth>
<_SelectedScaffolderID>ApiControllerWithContextScaffolder</_SelectedScaffolderID>
<_SelectedScaffolderCategoryPath>root/Common</_SelectedScaffolderCategoryPath>
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_DbContextTypeFullName>PlsAPI.Models.CCAIContext</WebStackScaffolding_DbContextTypeFullName>
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
</PropertyGroup>
</Project>
25 changes: 25 additions & 0 deletions PlsAPI.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlsAPI", "PlsAPI.csproj", "{832B4FB7-9FB7-46F1-99B9-AD1013D4E1AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{832B4FB7-9FB7-46F1-99B9-AD1013D4E1AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{832B4FB7-9FB7-46F1-99B9-AD1013D4E1AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{832B4FB7-9FB7-46F1-99B9-AD1013D4E1AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{832B4FB7-9FB7-46F1-99B9-AD1013D4E1AA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {63261BA5-206D-4F91-9EA7-5FB6028E731A}
EndGlobalSection
EndGlobal
26 changes: 26 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace PlsAPI
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
Loading