Skip to content

Commit 643192c

Browse files
committed
initial files
1 parent af81143 commit 643192c

File tree

214 files changed

+56787
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+56787
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30803.129
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jquery-autocomplete-aspnet-mvc-core", "jquery-autocomplete-aspnet-mvc-core\jquery-autocomplete-aspnet-mvc-core.csproj", "{A516E567-2086-4F21-9F10-8D48A218CC95}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A516E567-2086-4F21-9F10-8D48A218CC95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A516E567-2086-4F21-9F10-8D48A218CC95}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A516E567-2086-4F21-9F10-8D48A218CC95}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A516E567-2086-4F21-9F10-8D48A218CC95}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {FFC1839A-BE0D-4D79-8B9F-C5907F41EDBA}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Microsoft.AspNetCore.Http;
2+
using Microsoft.AspNetCore.Mvc;
3+
using System;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.EntityFrameworkCore;
7+
using jquery_autocomplete_aspnet_mvc_core.Areas.Purchasing.Models;
8+
9+
namespace jquery_autocomplete_aspnet_mvc_core.Areas.Purchasing.Controllers
10+
{
11+
[Route("api/vendor")]
12+
[ApiController]
13+
public class VendorAPIController : ControllerBase
14+
{
15+
private VendorContext db = new VendorContext();
16+
17+
[Produces("application/json")]
18+
[HttpGet("search")]
19+
[Route("api/vendor/search")]
20+
[ValidateAntiForgeryToken]
21+
public async Task<IActionResult> Search()
22+
{
23+
try
24+
{
25+
string term = HttpContext.Request.Query["term"].ToString();
26+
27+
var names = db.Vendors.Where(p => p.Name.Contains(term)).Select(p => p.Name).ToListAsync();
28+
return Ok(await names);
29+
}
30+
catch(Exception ex)
31+
{
32+
return BadRequest();
33+
}
34+
}
35+
}
36+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace jquery_autocomplete_aspnet_mvc_core.Areas.Purchasing.Controllers
4+
{
5+
[Area("purchasing")]
6+
public class VendorController : Controller
7+
{
8+
[Route("/vendor/VendorOrders")]
9+
public IActionResult VendorOrders()
10+
{
11+
return View();
12+
}
13+
}
14+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+

2+
using System.ComponentModel.DataAnnotations;
3+
using System.ComponentModel.DataAnnotations.Schema;
4+
5+
namespace jquery_autocomplete_aspnet_mvc_core.Areas.Purchasing.Models
6+
{
7+
[Table("Vendor", Schema = "Purchasing")]
8+
public class Vendor
9+
{
10+
[Key]
11+
public int BusinessEntityID { get; set; }
12+
13+
public string AccountNumber { get; set; }
14+
15+
public string Name { get; set; }
16+
17+
}
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Microsoft.EntityFrameworkCore;
2+
using Microsoft.Extensions.Configuration;
3+
using System.IO;
4+
5+
namespace jquery_autocomplete_aspnet_mvc_core.Areas.Purchasing.Models
6+
{
7+
public class VendorContext : DbContext
8+
{
9+
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
10+
{
11+
var builder = new ConfigurationBuilder()
12+
.SetBasePath(Directory.GetCurrentDirectory())
13+
.AddJsonFile("appsettings.json");
14+
var configuration = builder.Build();
15+
optionsBuilder.UseSqlServer(configuration["ConnectionStrings:DefaultConnection"]);
16+
}
17+
18+
public DbSet<Vendor> Vendors { get; set; }
19+
}
20+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
@{
3+
ViewData["Title"] = "Vendor Orders";
4+
Layout = "~/Views/Shared/_Layout.cshtml";
5+
}
6+
7+
<h1>AutoComplete in ASP.NET Core MVC</h1>
8+
<div>
9+
<br />
10+
<br />
11+
<dl class="row">
12+
<dt >
13+
<span>Vendor Name</span>
14+
</dt>
15+
<dd class="col-sm-8">
16+
<input type="text" id="vendorName" placeholder="Enter Vendor Name" />
17+
</dd>
18+
</dl>
19+
</div>
20+
<div>
21+
You selected Vendor: <b><span id="lblVendorName"></span></b>
22+
</div>
23+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using jquery_autocomplete_aspnet_mvc_core.Models;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.Extensions.Logging;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Diagnostics;
7+
using System.Linq;
8+
using System.Threading.Tasks;
9+
10+
namespace jquery_autocomplete_aspnet_mvc_core.Controllers
11+
{
12+
public class HomeController : Controller
13+
{
14+
private readonly ILogger<HomeController> _logger;
15+
16+
public HomeController(ILogger<HomeController> logger)
17+
{
18+
_logger = logger;
19+
}
20+
21+
public IActionResult Index()
22+
{
23+
return View();
24+
}
25+
26+
public IActionResult Privacy()
27+
{
28+
return View();
29+
}
30+
31+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
32+
public IActionResult Error()
33+
{
34+
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
35+
}
36+
}
37+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
namespace jquery_autocomplete_aspnet_mvc_core.Models
4+
{
5+
public class ErrorViewModel
6+
{
7+
public string RequestId { get; set; }
8+
9+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10+
}
11+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Microsoft.AspNetCore.Hosting;
2+
using Microsoft.Extensions.Configuration;
3+
using Microsoft.Extensions.Hosting;
4+
using Microsoft.Extensions.Logging;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Threading.Tasks;
9+
10+
namespace jquery_autocomplete_aspnet_mvc_core
11+
{
12+
public class Program
13+
{
14+
public static void Main(string[] args)
15+
{
16+
CreateHostBuilder(args).Build().Run();
17+
}
18+
19+
public static IHostBuilder CreateHostBuilder(string[] args) =>
20+
Host.CreateDefaultBuilder(args)
21+
.ConfigureWebHostDefaults(webBuilder =>
22+
{
23+
webBuilder.UseStartup<Startup>();
24+
});
25+
}
26+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:51092",
7+
"sslPort": 44320
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"jquery_autocomplete_aspnet_mvc_core": {
19+
"commandName": "Project",
20+
"dotnetRunMessages": "true",
21+
"launchBrowser": true,
22+
"applicationUrl": "https://localhost:5001;http://localhost:5000",
23+
"environmentVariables": {
24+
"ASPNETCORE_ENVIRONMENT": "Development"
25+
}
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)