59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
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 |