support for vendor notifications webhook

This commit is contained in:
2022-08-29 20:57:24 +00:00
parent 541cf1d2ae
commit 0d6425cf8b
11 changed files with 485 additions and 76 deletions

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.EntityFrameworkCore;
using rockfishCore.Models;
using rockfishCore.Util;
using System.ComponentModel.DataAnnotations;
namespace rockfishCore.Controllers
{
//### OUR ROUTE CALLED FROM ROCKFISH CLIENT ####
[Produces("application/json")]
[Route("api/vendor-notifications")]
[Authorize]
public class VendorNotificationController : Controller
{
private readonly rockfishContext ct;
public VendorNotificationController(rockfishContext context)
{
ct = context;
}
// GET: api/vendor-notifications/5
[HttpGet("{id}")]
public async Task<IActionResult> GetRfCase([FromRoute] long id)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
var RfCase = await ct.VendorNotification.SingleOrDefaultAsync(m => m.Id == id);
if (RfCase == null)
{
return NotFound();
}
return Ok(RfCase);
}
[HttpGet("list")]
public async Task<IActionResult> GetList([FromRoute] long siteId)
{
return Ok(await ct.VendorNotification.AsNoTracking().OrderByDescending(z => z.Id).ToListAsync());
}
}//eoc
}//eons