This commit is contained in:
@@ -14,7 +14,7 @@ namespace rockfishCore.Controllers
|
|||||||
{
|
{
|
||||||
//### OUR ROUTE CALLED FROM ROCKFISH CLIENT ####
|
//### OUR ROUTE CALLED FROM ROCKFISH CLIENT ####
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Route("rvl")]
|
[Route("api/rvl")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class RvlController : Controller
|
public class RvlController : Controller
|
||||||
{
|
{
|
||||||
@@ -143,9 +143,14 @@ namespace rockfishCore.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public ActionResult GetTest()
|
||||||
|
{
|
||||||
|
return Ok("hi");
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("list/{siteId}")]
|
[HttpGet("list/{siteId}")]
|
||||||
public async Task<IActionResult> GetList(long siteId)
|
public async Task<IActionResult> GetList([FromRoute] long siteId)
|
||||||
{
|
{
|
||||||
return Ok(await ct.License.AsNoTracking().Where(z => z.SiteId == siteId).OrderByDescending(z => z.Id).ToListAsync());
|
return Ok(await ct.License.AsNoTracking().Where(z => z.SiteId == siteId).OrderByDescending(z => z.Id).ToListAsync());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ namespace rockfishCore.Controllers
|
|||||||
[Authorize]
|
[Authorize]
|
||||||
public class SiteController : Controller
|
public class SiteController : Controller
|
||||||
{
|
{
|
||||||
private readonly rockfishContext _context;
|
private readonly rockfishContext ct;
|
||||||
|
|
||||||
public SiteController(rockfishContext context)
|
public SiteController(rockfishContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
ct = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ namespace rockfishCore.Controllers
|
|||||||
[HttpGet("{id}/purchases")]
|
[HttpGet("{id}/purchases")]
|
||||||
public IEnumerable<Purchase> GetPurchases([FromRoute] long id)
|
public IEnumerable<Purchase> GetPurchases([FromRoute] long id)
|
||||||
{
|
{
|
||||||
var l = _context.Purchase
|
var l = ct.Purchase
|
||||||
.Where(b => b.SiteId.Equals(id))
|
.Where(b => b.SiteId.Equals(id))
|
||||||
.OrderByDescending(b => b.PurchaseDate)
|
.OrderByDescending(b => b.PurchaseDate)
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -46,13 +46,13 @@ namespace rockfishCore.Controllers
|
|||||||
// return l;
|
// return l;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//Get api/site/77/activepurchases
|
//Get api/site/77/activepurchases
|
||||||
[HttpGet("{id}/activepurchases")]
|
[HttpGet("{id}/activepurchases")]
|
||||||
public IEnumerable<dtoNameIdItem> GetActivePurchases([FromRoute] long id)
|
public IEnumerable<dtoNameIdItem> GetActivePurchases([FromRoute] long id)
|
||||||
{
|
{
|
||||||
var res = from c in _context.Purchase
|
var res = from c in ct.Purchase
|
||||||
.Where(c => c.SiteId.Equals(id))
|
.Where(c => c.SiteId.Equals(id))
|
||||||
.Where(c => c.CancelDate==null)
|
.Where(c => c.CancelDate == null)
|
||||||
.OrderByDescending(c => c.PurchaseDate)
|
.OrderByDescending(c => c.PurchaseDate)
|
||||||
select new dtoNameIdItem
|
select new dtoNameIdItem
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ namespace rockfishCore.Controllers
|
|||||||
return BadRequest(ModelState);
|
return BadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ret = await _context.Site
|
var ret = await ct.Site
|
||||||
.Select(r => new { r.Id, r.Name, r.CustomerId })
|
.Select(r => new { r.Id, r.Name, r.CustomerId })
|
||||||
.Where(r => r.Id == id)
|
.Where(r => r.Id == id)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
@@ -107,7 +107,7 @@ namespace rockfishCore.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<Site> GetSite()
|
public IEnumerable<Site> GetSite()
|
||||||
{
|
{
|
||||||
return _context.Site;
|
return ct.Site;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Site/5
|
// GET: api/Site/5
|
||||||
@@ -119,7 +119,7 @@ namespace rockfishCore.Controllers
|
|||||||
return BadRequest(ModelState);
|
return BadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
var site = await _context.Site.AsNoTracking().SingleOrDefaultAsync(m => m.Id == id);
|
var site = await ct.Site.AsNoTracking().SingleOrDefaultAsync(m => m.Id == id);
|
||||||
|
|
||||||
if (site == null)
|
if (site == null)
|
||||||
{
|
{
|
||||||
@@ -143,11 +143,11 @@ namespace rockfishCore.Controllers
|
|||||||
return BadRequest();
|
return BadRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.Entry(site).State = EntityState.Modified;
|
ct.Entry(site).State = EntityState.Modified;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _context.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
catch (DbUpdateConcurrencyException)
|
catch (DbUpdateConcurrencyException)
|
||||||
{
|
{
|
||||||
@@ -173,8 +173,8 @@ namespace rockfishCore.Controllers
|
|||||||
return BadRequest(ModelState);
|
return BadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.Site.Add(site);
|
ct.Site.Add(site);
|
||||||
await _context.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
|
|
||||||
return CreatedAtAction("GetSite", new { id = site.Id }, site);
|
return CreatedAtAction("GetSite", new { id = site.Id }, site);
|
||||||
}
|
}
|
||||||
@@ -190,7 +190,7 @@ namespace rockfishCore.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var site = await _context.Site.SingleOrDefaultAsync(m => m.Id == id);
|
var site = await ct.Site.SingleOrDefaultAsync(m => m.Id == id);
|
||||||
|
|
||||||
if (site == null)
|
if (site == null)
|
||||||
{
|
{
|
||||||
@@ -198,15 +198,21 @@ namespace rockfishCore.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_context.Site.Remove(site);
|
if (await ct.License.Where(z => z.SiteId == id).AnyAsync())
|
||||||
await _context.SaveChangesAsync();
|
{
|
||||||
|
return BadRequest("This site has licenses and can not be deleted");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ct.Site.Remove(site);
|
||||||
|
await ct.SaveChangesAsync();
|
||||||
|
|
||||||
return Ok(site);
|
return Ok(site);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SiteExists(long id)
|
private bool SiteExists(long id)
|
||||||
{
|
{
|
||||||
return _context.Site.Any(e => e.Id == id);
|
return ct.Site.Any(e => e.Id == id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,7 @@ app.api = (function () {
|
|||||||
putAction,
|
putAction,
|
||||||
postAction,
|
postAction,
|
||||||
createLicense,
|
createLicense,
|
||||||
|
createRavLicense,
|
||||||
getLicenseRequests,
|
getLicenseRequests,
|
||||||
generateFromRequest,
|
generateFromRequest,
|
||||||
licenseEmailResponse;
|
licenseEmailResponse;
|
||||||
@@ -273,8 +274,7 @@ app.api = (function () {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
//CreateRavLicense
|
//CreateRavLicense
|
||||||
//Route app.post('/api/license/create', function (req, res) {
|
//Route app.post('/api/license/create', function (req, res) {
|
||||||
//
|
//
|
||||||
@@ -299,7 +299,6 @@ app.api = (function () {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
//GetLicenseRequests
|
//GetLicenseRequests
|
||||||
//Fetch license requests
|
//Fetch license requests
|
||||||
@@ -387,6 +386,7 @@ app.api = (function () {
|
|||||||
putAction: putAction,
|
putAction: putAction,
|
||||||
postAction: postAction,
|
postAction: postAction,
|
||||||
createLicense: createLicense,
|
createLicense: createLicense,
|
||||||
|
createRavLicense: createRavLicense,
|
||||||
getLicenseRequests: getLicenseRequests,
|
getLicenseRequests: getLicenseRequests,
|
||||||
generateFromRequest: generateFromRequest,
|
generateFromRequest: generateFromRequest,
|
||||||
licenseEmailResponse: licenseEmailResponse
|
licenseEmailResponse: licenseEmailResponse
|
||||||
|
|||||||
@@ -131,6 +131,9 @@ app.ravLicense = (function () {
|
|||||||
}
|
}
|
||||||
$container.html(Handlebars.templates['app.ravLicense']({}));
|
$container.html(Handlebars.templates['app.ravLicense']({}));
|
||||||
|
|
||||||
|
///ravLicense/:id/:site_id
|
||||||
|
//either fetch one to display or start one to create
|
||||||
|
debugger;
|
||||||
|
|
||||||
//case 3233 customer list
|
//case 3233 customer list
|
||||||
//Fill customer list combo
|
//Fill customer list combo
|
||||||
|
|||||||
@@ -240,8 +240,8 @@ app.shell = (function () {
|
|||||||
page('/ops', ops);
|
page('/ops', ops);
|
||||||
page('/trials', trials);
|
page('/trials', trials);
|
||||||
page('/trialEdit/:id', trialEdit);
|
page('/trialEdit/:id', trialEdit);
|
||||||
page('/ravLicenses/:id/', ravLicenses);
|
page('/ravLicenses/:id', ravLicenses);
|
||||||
page('/ravLicense/:id/:site_id', ravLicense);
|
page('/ravLicense/:id', ravLicense);
|
||||||
page('*', notFound);
|
page('*', notFound);
|
||||||
page({
|
page({
|
||||||
hashbang: true
|
hashbang: true
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user