Upload project.
This commit is contained in:
79
ThAmCo.Catering/Controllers/BookingsController.cs
Normal file
79
ThAmCo.Catering/Controllers/BookingsController.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ThAmCo.Catering.Data;
|
||||
using ThAmCo.Venues.Data;
|
||||
|
||||
namespace ThAmCo.Catering.Controllers
|
||||
{
|
||||
public class BookingsController
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ValuesController : ControllerBase
|
||||
{
|
||||
private readonly CateringDbContext _context;
|
||||
|
||||
public ValuesController(CateringDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET api/values
|
||||
[HttpGet]
|
||||
public ActionResult<IEnumerable<Menu>> Get()
|
||||
{
|
||||
return _context.Menus.ToArray();
|
||||
}
|
||||
|
||||
// GET api/values/5
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<string> Get(int id)
|
||||
{
|
||||
var menu = _context.Menus.FirstOrDefault(f => f.Id == id);
|
||||
|
||||
if (menu != null)
|
||||
{
|
||||
return Ok(menu);
|
||||
}
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// POST api/values/
|
||||
//Gives the function the menuid it wants to book.
|
||||
[HttpPost]
|
||||
public IActionResult Post([FromBody] int id)
|
||||
{
|
||||
if (_context.Menus.Any(m => m.Id == id))
|
||||
{
|
||||
FoodBooking fb = new FoodBooking
|
||||
{
|
||||
MenuId = id,
|
||||
//Notes = notes,
|
||||
};
|
||||
|
||||
var updatedFB = _context.Add(fb);
|
||||
_context.SaveChangesAsync();
|
||||
|
||||
return Ok(updatedFB);
|
||||
}
|
||||
return BadRequest("MenuID was not found.");
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
93
ThAmCo.Catering/Controllers/ValuesController.cs
Normal file
93
ThAmCo.Catering/Controllers/ValuesController.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ThAmCo.Catering.Data;
|
||||
using ThAmCo.Venues.Data;
|
||||
|
||||
namespace ThAmCo.Catering.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ValuesController : ControllerBase
|
||||
{
|
||||
private readonly CateringDbContext _context;
|
||||
|
||||
public ValuesController(CateringDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET api/values
|
||||
[HttpGet]
|
||||
public ActionResult<IEnumerable<Menu>> Get()
|
||||
{
|
||||
return _context.Menus.ToArray();
|
||||
}
|
||||
|
||||
// GET api/values/5
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<string> Get(int id)
|
||||
{
|
||||
var menu = _context.Menus.FirstOrDefault(f => f.Id == id);
|
||||
|
||||
if (menu != null)
|
||||
{
|
||||
return Ok(menu);
|
||||
}
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// POST api/values/
|
||||
//Gives the function the menuid it wants to book.
|
||||
[HttpPost]
|
||||
public IActionResult Post([FromBody] int id)
|
||||
{
|
||||
if (_context.Menus.Any(m => m.Id == id))
|
||||
{
|
||||
FoodBooking fb = new FoodBooking
|
||||
{
|
||||
MenuId = id,
|
||||
//Notes = notes,
|
||||
};
|
||||
|
||||
var updatedFB = _context.Add(fb);
|
||||
_context.SaveChangesAsync();
|
||||
|
||||
return Ok(updatedFB);
|
||||
}
|
||||
return BadRequest("MenuID was not found.");
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
[HttpPut("{id}")]
|
||||
public IActionResult Put([Bind("Items,Price")] Menu food)
|
||||
{
|
||||
//If menu exists, edit the current entry.
|
||||
if (_context.Menus.Any(m => m.Id == food.Id) && ModelState.IsValid)
|
||||
{
|
||||
var menu = _context.Menus.First(m => m.Id == food.Id);
|
||||
|
||||
_context.Update(menu);
|
||||
_context.SaveChangesAsync();
|
||||
return Ok(menu);
|
||||
}
|
||||
//If menu doesn't exist, make a current entry.
|
||||
else if (ModelState.IsValid)
|
||||
{
|
||||
_context.Add(food);
|
||||
_context.SaveChangesAsync();
|
||||
return Ok();
|
||||
}
|
||||
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
58
ThAmCo.Catering/Data/CateringDbContext.cs
Normal file
58
ThAmCo.Catering/Data/CateringDbContext.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ThAmCo.Catering.Data;
|
||||
|
||||
namespace ThAmCo.Venues.Data
|
||||
{
|
||||
public class CateringDbContext : DbContext
|
||||
{
|
||||
public DbSet<Menu> Menus { get; set; }
|
||||
public DbSet<FoodBooking> FoodBookings { get; set; }
|
||||
|
||||
private readonly IHostingEnvironment _hostEnv;
|
||||
|
||||
public CateringDbContext(DbContextOptions<CateringDbContext> options,
|
||||
IHostingEnvironment env) : base(options)
|
||||
{
|
||||
_hostEnv = env;
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder builder)
|
||||
{
|
||||
base.OnConfiguring(builder);
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.HasDefaultSchema("thamco.catering");
|
||||
|
||||
builder.Entity<Menu>()
|
||||
.HasKey(m => m.Id);
|
||||
|
||||
builder.Entity<FoodBooking>()
|
||||
.HasKey(f => f.Id);
|
||||
|
||||
builder.Entity<Menu>()
|
||||
.HasMany(f => f.FoodBookings)
|
||||
.WithOne(m => m.Menu)
|
||||
.HasForeignKey(m => m.Id);
|
||||
|
||||
|
||||
|
||||
if (_hostEnv != null && _hostEnv.IsDevelopment())
|
||||
{
|
||||
builder.Entity<Menu>()
|
||||
.HasData(
|
||||
new Menu { Id = 1, Price = 8.50, Items = "Chicken Pate, Chicken Roast, Chicken Cake" },
|
||||
new Menu { Id = 2, Price = 7.50, Items = "Toast, Cheese On Toast, Jam on Toast" },
|
||||
new Menu { Id = 3, Price = 9, Items = "Mac and Cheese, Alan's Special, Cheesecake" }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
ThAmCo.Catering/Data/FoodBooking.cs
Normal file
20
ThAmCo.Catering/Data/FoodBooking.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ThAmCo.Catering.Data
|
||||
{
|
||||
public class FoodBooking
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int MenuId { get; set; }
|
||||
|
||||
public Menu Menu { get; set; }
|
||||
|
||||
public string Notes { get; set; }
|
||||
}
|
||||
}
|
||||
18
ThAmCo.Catering/Data/Menu.cs
Normal file
18
ThAmCo.Catering/Data/Menu.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ThAmCo.Catering.Data
|
||||
{
|
||||
public class Menu
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Items { get; set; }
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
public List<FoodBooking> FoodBookings { get; set; }
|
||||
}
|
||||
}
|
||||
68
ThAmCo.Catering/Migrations/20181204120817_InitialCreate.Designer.cs
generated
Normal file
68
ThAmCo.Catering/Migrations/20181204120817_InitialCreate.Designer.cs
generated
Normal file
@@ -0,0 +1,68 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ThAmCo.Venues.Data;
|
||||
|
||||
namespace ThAmCo.Catering.Migrations
|
||||
{
|
||||
[DbContext(typeof(CateringDbContext))]
|
||||
[Migration("20181204120817_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("thamco.catering")
|
||||
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Catering.Data.FoodBooking", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<int>("MenuId");
|
||||
|
||||
b.Property<string>("Notes");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("FoodBookings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Catering.Data.Menu", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Items");
|
||||
|
||||
b.Property<double>("Price");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Menus");
|
||||
|
||||
b.HasData(
|
||||
new { Id = 1, Items = "Chicken Pate, Chicken Roast, Chicken Cake", Price = 8.5 },
|
||||
new { Id = 2, Items = "Toast, Cheese On Toast, Jam on Toast", Price = 7.5 },
|
||||
new { Id = 3, Items = "Mac and Cheese, Alan's Special, Cheesecake", Price = 9.0 }
|
||||
);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Catering.Data.FoodBooking", b =>
|
||||
{
|
||||
b.HasOne("ThAmCo.Catering.Data.Menu", "Menu")
|
||||
.WithMany("FoodBookings")
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
79
ThAmCo.Catering/Migrations/20181204120817_InitialCreate.cs
Normal file
79
ThAmCo.Catering/Migrations/20181204120817_InitialCreate.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ThAmCo.Catering.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "thamco.catering");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Menus",
|
||||
schema: "thamco.catering",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
Items = table.Column<string>(nullable: true),
|
||||
Price = table.Column<double>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Menus", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "FoodBookings",
|
||||
schema: "thamco.catering",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
MenuId = table.Column<int>(nullable: false),
|
||||
Notes = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_FoodBookings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_FoodBookings_Menus_Id",
|
||||
column: x => x.Id,
|
||||
principalSchema: "thamco.catering",
|
||||
principalTable: "Menus",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "thamco.catering",
|
||||
table: "Menus",
|
||||
columns: new[] { "Id", "Items", "Price" },
|
||||
values: new object[] { 1, "Chicken Pate, Chicken Roast, Chicken Cake", 8.5 });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "thamco.catering",
|
||||
table: "Menus",
|
||||
columns: new[] { "Id", "Items", "Price" },
|
||||
values: new object[] { 2, "Toast, Cheese On Toast, Jam on Toast", 7.5 });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "thamco.catering",
|
||||
table: "Menus",
|
||||
columns: new[] { "Id", "Items", "Price" },
|
||||
values: new object[] { 3, "Mac and Cheese, Alan's Special, Cheesecake", 9.0 });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "FoodBookings",
|
||||
schema: "thamco.catering");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Menus",
|
||||
schema: "thamco.catering");
|
||||
}
|
||||
}
|
||||
}
|
||||
66
ThAmCo.Catering/Migrations/CateringDbContextModelSnapshot.cs
Normal file
66
ThAmCo.Catering/Migrations/CateringDbContextModelSnapshot.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ThAmCo.Venues.Data;
|
||||
|
||||
namespace ThAmCo.Catering.Migrations
|
||||
{
|
||||
[DbContext(typeof(CateringDbContext))]
|
||||
partial class CateringDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("thamco.catering")
|
||||
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Catering.Data.FoodBooking", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<int>("MenuId");
|
||||
|
||||
b.Property<string>("Notes");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("FoodBookings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Catering.Data.Menu", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Items");
|
||||
|
||||
b.Property<double>("Price");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Menus");
|
||||
|
||||
b.HasData(
|
||||
new { Id = 1, Items = "Chicken Pate, Chicken Roast, Chicken Cake", Price = 8.5 },
|
||||
new { Id = 2, Items = "Toast, Cheese On Toast, Jam on Toast", Price = 7.5 },
|
||||
new { Id = 3, Items = "Mac and Cheese, Alan's Special, Cheesecake", Price = 9.0 }
|
||||
);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Catering.Data.FoodBooking", b =>
|
||||
{
|
||||
b.HasOne("ThAmCo.Catering.Data.Menu", "Menu")
|
||||
.WithMany("FoodBookings")
|
||||
.HasForeignKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
43
ThAmCo.Catering/Program.cs
Normal file
43
ThAmCo.Catering/Program.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ThAmCo.Venues.Data;
|
||||
|
||||
namespace ThAmCo.Catering
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = CreateWebHostBuilder(args).Build();
|
||||
|
||||
using (var scope = host.Services.CreateScope())
|
||||
{
|
||||
var services = scope.ServiceProvider;
|
||||
var env = services.GetRequiredService<IHostingEnvironment>();
|
||||
var context = services.GetRequiredService<CateringDbContext>();
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
context.Database.EnsureDeleted();
|
||||
}
|
||||
context.Database.Migrate();
|
||||
}
|
||||
|
||||
host.Run();
|
||||
|
||||
CreateWebHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>();
|
||||
}
|
||||
}
|
||||
30
ThAmCo.Catering/Properties/launchSettings.json
Normal file
30
ThAmCo.Catering/Properties/launchSettings.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:32824",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "api/values",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ThAmCo.Catering": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "api/values",
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
49
ThAmCo.Catering/Startup.cs
Normal file
49
ThAmCo.Catering/Startup.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ThAmCo.Venues.Data;
|
||||
|
||||
namespace ThAmCo.Catering
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
||||
|
||||
services.AddDbContext<CateringDbContext>(options =>
|
||||
{
|
||||
var cs = Configuration.GetConnectionString("CateringSqlConnection");
|
||||
options.UseSqlServer(cs);
|
||||
});
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.UseMvc();
|
||||
}
|
||||
}
|
||||
}
|
||||
16
ThAmCo.Catering/ThAmCo.Catering.csproj
Normal file
16
ThAmCo.Catering/ThAmCo.Catering.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.Net.Compilers" Version="2.10.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
9
ThAmCo.Catering/appsettings.Development.json
Normal file
9
ThAmCo.Catering/appsettings.Development.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
11
ThAmCo.Catering/appsettings.json
Normal file
11
ThAmCo.Catering/appsettings.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"CateringSqlConnection": "Server=(localdb)\\mssqllocaldb;Database=Catering;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Reference in New Issue
Block a user