Beispiel #1
0
 public void Delete(int id)
 {
     if (UserPermissions.IsAuthorized(User, "Module", id, "Edit"))
     {
         Modules.DeleteModule(id);
         logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
     }
 }
Beispiel #2
0
        public RedirectToActionResult Delete(Models.Module mod)
        {
            if (ModelState.IsValid)
            {
                repository.DeleteModule(mod.Mod_Code, mod.Mod_Sys_Code);
            }

            // ModelState.Clear();
            return(RedirectToAction(nameof(Index)));
        }
 public void Delete(int id)
 {
     if (_userPermissions.IsAuthorized(User, EntityNames.Module, id, PermissionNames.Edit))
     {
         _modules.DeleteModule(id);
         _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
     }
     else
     {
         _logger.Log(LogLevel.Error, this, LogFunction.Delete, "User Not Authorized To Delete Module {ModuleId}", id);
         HttpContext.Response.StatusCode = 401;
     }
 }
 public void Delete(int id)
 {
     if (UserPermissions.IsAuthorized(User, "Module", id, "Edit"))
     {
         Modules.DeleteModule(id);
         logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
     }
     else
     {
         logger.Log(LogLevel.Error, this, LogFunction.Delete, "User Not Authorized To Delete Module {ModuleId}", id);
         HttpContext.Response.StatusCode = 401;
     }
 }
 public void Delete(int id)
 {
     if (_userPermissions.IsAuthorized(User, EntityNames.Module, id, PermissionNames.Edit))
     {
         _modules.DeleteModule(id);
         _syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.Site, _tenants.GetAlias().SiteId);
         _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
     }
     else
     {
         _logger.Log(LogLevel.Error, this, LogFunction.Delete, "User Not Authorized To Delete Module {ModuleId}", id);
         HttpContext.Response.StatusCode = 401;
     }
 }
Beispiel #6
0
        public void Delete(int id)
        {
            var module = _modules.GetModule(id);

            if (module != null && module.SiteId == _alias.SiteId && _userPermissions.IsAuthorized(User, EntityNames.Page, module.ModuleId, PermissionNames.Edit))
            {
                _modules.DeleteModule(id);
                _syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, _alias.SiteId);
                _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
            }
            else
            {
                _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Module Delete Attempt {ModuleId}", id);
                HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
            }
        }
        public IHttpActionResult Delete(string name, string version)
        {
            try
            {
                var module = _repository.GetModule(name, version);

                if (module == null)
                {
                    return(NotFound());
                }

                _repository.DeleteModule(module);

                return(Ok());
            }
            catch (Exception e)
            {
                return(HandleUnexpectedException(10017, e));
            }
        }
        public async Task <IActionResult> DeleteModule(Guid id)
        {
            try
            {
                var module
                    = await _moduleRepository.FindModule(id);

                if (module == null)
                {
                    return(BadRequest(new ErrorMessage(ErrorMessageResponses.UnableToFindModule)));
                }
                await _moduleRepository.DeleteModule(module);

                return(Ok(id));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);

                return(BadRequest(new ErrorResponse(ex)));
            }
        }
        public async Task <ValidationResult> DeleteModule(Guid id)
        {
            var validationResult = new ValidationResult();

            var module = _moduleRepository.GetModule(id);

            if (module == null)
            {
                return(null);
            }

            var classroom = _classroomRepository.GetClassroomByModule(module.Id);

            if (classroom != null)
            {
                validationResult = _classroomValidator.Validate(classroom);
                return(validationResult);
            }

            await _moduleRepository.DeleteModule(id);

            return(validationResult);
        }
Beispiel #10
0
 public void Delete(int id)
 {
     modules.DeleteModule(id);
 }
Beispiel #11
0
 public async Task DeleteAsync(string id)
 {
     await repository.DeleteModule(id);
 }
Beispiel #12
0
 public bool DeleteModule(int id)
 {
     return(_moduleRepository.DeleteModule(id));
 }
            public async Task <Unit> Handle(DeleteModuleCommand request, CancellationToken cancellationToken)
            {
                await _moduleRepository.DeleteModule(request.Token, request.ModuleId);

                return(Unit.Value);
            }
 public void Delete(int id)
 {
     Modules.DeleteModule(id);
     logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
 }