示例#1
0
        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));
        }
示例#2
0
        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));
        }