add lastmodified and lastmodifiedid to table also add code for modified and create

This commit is contained in:
Kham
2021-09-01 16:03:05 +10:00
parent c5ab17115d
commit cc276d4a17
25 changed files with 255 additions and 115 deletions
@@ -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);
}