add lastmodified and lastmodifiedid to table also add code for modified and create
This commit is contained in:
@@ -21,6 +21,10 @@ namespace CarParkValidationAPI.Controllers
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> AdminUser([FromBody] AdminUserDto model)
|
||||
{
|
||||
var currentUser = (User)HttpContext.Items["User"];
|
||||
if (null == currentUser)
|
||||
return Unauthorized(new { message = "Unauthorized" });
|
||||
_adminUser.SetCurrentUser(currentUser.Username);
|
||||
var response = await _adminUser.SaveAdminUserAsync(model);
|
||||
return Ok(response);
|
||||
}
|
||||
@@ -47,12 +51,10 @@ namespace CarParkValidationAPI.Controllers
|
||||
[HttpDelete("{id:int}")]
|
||||
public async Task<IActionResult> DeleteAdminUser(int id)
|
||||
{
|
||||
/*
|
||||
// only admins can access other user records
|
||||
var currentUser = (User)HttpContext.Items["User"];
|
||||
if (id != currentUser.Id && currentUser.Role != Role.Admin)
|
||||
if (null == currentUser)
|
||||
return Unauthorized(new { message = "Unauthorized" });
|
||||
*/
|
||||
_adminUser.SetCurrentUser(currentUser.Username);
|
||||
var retval = await _adminUser.DeleteAdminUserAsync(id);
|
||||
return Ok(retval);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ namespace CarParkValidationAPI.Controllers
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> ConcessionType([FromBody] ConcessionTypeDto model)
|
||||
{
|
||||
var currentUser = (User)HttpContext.Items["User"];
|
||||
if (null == currentUser)
|
||||
return Unauthorized(new { message = "Unauthorized" });
|
||||
_concessionType.SetCurrentUser(currentUser.Username);
|
||||
var response = await _concessionType.SaveConcessionTypeAsync(model);
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace CarParkValidationAPI.Controllers
|
||||
public ConcessionValidationController(IConcessionValidation concessionValidation,
|
||||
ConcessionValidationReportRepository concesionReportReport)
|
||||
{
|
||||
|
||||
_concessionValidationReport = concesionReportReport;
|
||||
_concessionValidation = concessionValidation;
|
||||
}
|
||||
@@ -31,6 +32,10 @@ namespace CarParkValidationAPI.Controllers
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> ConcessionValidation([FromBody] ConcessionValidationDto model)
|
||||
{
|
||||
var currentUser = (User)HttpContext.Items["User"];
|
||||
if (null == currentUser)
|
||||
return Unauthorized(new { message = "Unauthorized" });
|
||||
_concessionValidation.SetCurrentUser(currentUser.Username);
|
||||
var response = await _concessionValidation.SaveConcessionValidationAsync(model);
|
||||
return Ok(response);
|
||||
}
|
||||
@@ -72,12 +77,12 @@ namespace CarParkValidationAPI.Controllers
|
||||
[HttpDelete("{id:int}")]
|
||||
public async Task<IActionResult> DeleteConcessionValidation(int id)
|
||||
{
|
||||
/*
|
||||
|
||||
// only admins can access other user records
|
||||
var currentUser = (User)HttpContext.Items["User"];
|
||||
if (id != currentUser.Id && currentUser.Role != Role.Admin)
|
||||
//if (id != currentUser.Id && currentUser.Role != Role.Admin)
|
||||
return Unauthorized(new { message = "Unauthorized" });
|
||||
*/
|
||||
//
|
||||
var retval = await _concessionValidation.DeleteConcessionValidationAsync(id);
|
||||
return Ok(retval);
|
||||
}
|
||||
|
||||
@@ -23,14 +23,17 @@ namespace CarParkValidationAPI.Controllers
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> ValidationPoint([FromBody] ValidationPointDto model)
|
||||
{
|
||||
var currentUser = (User)HttpContext.Items["User"];
|
||||
if (null == currentUser)
|
||||
return Unauthorized(new { message = "Unauthorized" });
|
||||
_validationPoint.SetCurrentUser(currentUser.Username);
|
||||
var response = await _validationPoint.SaveValidationPointAsync(model);
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> ValidationPoint(bool onlyActive=true)
|
||||
{
|
||||
{
|
||||
var retval = await _validationPoint.LoadValidationPointAsync(onlyActive);
|
||||
return Ok(retval);
|
||||
}
|
||||
@@ -50,12 +53,11 @@ namespace CarParkValidationAPI.Controllers
|
||||
[HttpDelete("{id:int}")]
|
||||
public async Task<IActionResult> DeleteConcessionType(int id)
|
||||
{
|
||||
/*
|
||||
// only admins can access other user records
|
||||
var currentUser = (User)HttpContext.Items["User"];
|
||||
if (id != currentUser.Id && currentUser.Role != Role.Admin)
|
||||
if (null == currentUser)
|
||||
return Unauthorized(new { message = "Unauthorized" });
|
||||
*/
|
||||
_validationPoint.SetCurrentUser(currentUser.Username);
|
||||
var retval = await _validationPoint.DeleteValidationPointAsync(id);
|
||||
return Ok(retval);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user