public IActionResult Delete(int id) { if (!AuthorizeService.AuthorizeUser(User, id)) { return(RedirectToAction("AccessDenied", "Auth")); } usersService.Delete(id); logsService.Log("Delete", $"Requested for user id: {id}", Convert.ToInt32(User.FindFirst("Id").Value)); if (Convert.ToInt32(User.FindFirst("Id").Value) == id) { return(RedirectToAction("SignOut", "Auth")); } return(RedirectToAction("SuccessfulUserChange")); }
public async Task Invoke(HttpContext httpContext, ILogsService logsService) { try { await _next(httpContext); } catch (System.Exception ex) { var logMessage = new { HttpRequestPath = httpContext.Request.Path, Exception = ex }; logsService.Log("Global", JsonConvert.SerializeObject(logMessage)); throw; } }