public IActionResult CreateCameraKey() { int?currentUserId = HttpContext.Session.GetInt32("currentUserId"); if (currentUserId == null || UserService.IsUserAdministrator(currentUserId.Value) == false) { return(RedirectToAction("SignIn", "Home")); } NewCameraKey newCameraKey = CameraService.GenerateUniqueCameraKey(); return(View("CreateCameraKey", newCameraKey)); }
public IActionResult DeleteCameraKey(string cameraKey) { int?currentUserId = HttpContext.Session.GetInt32("currentUserId"); if (currentUserId == null || UserService.IsUserAdministrator(currentUserId.Value) == false) { return(RedirectToAction("SignIn", "Home")); } bool success = CameraService.DeleteCameraFromKey(cameraKey); if (success == false) { return(View("Error")); } NewCameraKey deletedCameraKey = new NewCameraKey(cameraKey); return(View("DeleteCameraKey", deletedCameraKey)); }