Browse Source

Endpoint

pull/1240/head
espent1004 5 years ago
parent
commit
07e2d6ef7e
2 changed files with 107 additions and 0 deletions
  1. +106
    -0
      src/Services/TenantCustomisations/TenantACustomisations/Controllers/ShippingInformationsController.cs
  2. +1
    -0
      src/Services/TenantCustomisations/TenantACustomisations/TenantACustomisations.csproj

+ 106
- 0
src/Services/TenantCustomisations/TenantACustomisations/Controllers/ShippingInformationsController.cs View File

@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using TenantACustomisations.Database;
using TenantACustomisations.ExternalServices;
namespace TenantACustomisations.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ShippingInformationsController : ControllerBase
{
private readonly TenantAContext _context;
public ShippingInformationsController(TenantAContext context)
{
_context = context;
}
// GET: api/ShippingInformations
[HttpGet]
public async Task<ActionResult<IEnumerable<ShippingInformation>>> GetShippingInformation()
{
return await _context.ShippingInformation.ToListAsync();
}
// GET: api/ShippingInformations/5
[HttpGet("{id}")]
public async Task<ActionResult<ShippingInformation>> GetShippingInformation(int id)
{
var shippingInformation = await _context.ShippingInformation.FindAsync(id);
if (shippingInformation == null)
{
return NotFound();
}
return shippingInformation;
}
// PUT: api/ShippingInformations/5
[HttpPut("{id}")]
public async Task<IActionResult> PutShippingInformation(int id, ShippingInformation shippingInformation)
{
if (id != shippingInformation.ShippingInformationId)
{
return BadRequest();
}
_context.Entry(shippingInformation).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ShippingInformationExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
// POST: api/ShippingInformations
[HttpPost]
public async Task<ActionResult<ShippingInformation>> PostShippingInformation(ShippingInformation shippingInformation)
{
_context.ShippingInformation.Add(shippingInformation);
await _context.SaveChangesAsync();
return CreatedAtAction("GetShippingInformation", new { id = shippingInformation.ShippingInformationId }, shippingInformation);
}
// DELETE: api/ShippingInformations/5
[HttpDelete("{id}")]
public async Task<ActionResult<ShippingInformation>> DeleteShippingInformation(int id)
{
var shippingInformation = await _context.ShippingInformation.FindAsync(id);
if (shippingInformation == null)
{
return NotFound();
}
_context.ShippingInformation.Remove(shippingInformation);
await _context.SaveChangesAsync();
return shippingInformation;
}
private bool ShippingInformationExists(int id)
{
return _context.ShippingInformation.Any(e => e.ShippingInformationId == id);
}
}
}

+ 1
- 0
src/Services/TenantCustomisations/TenantACustomisations/TenantACustomisations.csproj View File

@ -28,6 +28,7 @@
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />
<PackageReference Include="Polly" Version="6.0.1" />
<PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />


Loading…
Cancel
Save