public IHttpActionResult Search(string query)
 {
     if (!string.IsNullOrEmpty(query) && query.Length > 1)
     {
         return(Ok(ThreatCategoryService.Search(query)));
     }
     else
     {
         return(Ok(new List <SimpleSearchResult>()));
     }
 }
Beispiel #2
0
        public void Init()
        {
            _transactionScope        = new TransactionScope(TransactionScopeOption.Required);
            _userService             = new UserService();
            _companyService          = new CompanyService(_userService);
            _assetService            = new AssetService(_userService);
            _assetSubCategoryService = new AssetSubCategoryService();
            _threatCategoryService   = new ThreatCategoryService();
            _controlCategoryService  = new ControlCategoryService();

            if (HttpContext.Current == null)
            {
                SimpleWorkerRequest request = new SimpleWorkerRequest("", "", "", null, new StringWriter());
                HttpContext         context = new HttpContext(request);
                HttpContext.Current = context;
            }
            ResetAdminPassword();
            HttpContext.Current.User =
                new GenericPrincipal(RAAPAuthProvider.ToClaimsIdentity("None",
                                                                       _userService.GetIdentityUserByLogin("admin", "Test123")), new string[] {});
        }
 public IHttpActionResult Delete(int id)
 {
     ThreatCategoryService.Delete(id);
     return(Ok());
 }
 public IHttpActionResult Put([FromBody] Contracts.ThreatCategory.UpdateThreatCategory update)
 {
     ThreatCategoryService.Update(update);
     return(Ok());
 }
 public IHttpActionResult Post([FromBody] Contracts.ThreatCategory.CreateThreatCategory create)
 {
     ThreatCategoryService.Create(create);
     return(Ok());
 }
        public IHttpActionResult Get(int id)
        {
            var result = ThreatCategoryService.GetSingle(id);

            return(Ok(result));
        }
        public IHttpActionResult Get([FromUri] PagedQuery pagedQuery)
        {
            var result = ThreatCategoryService.Get(pagedQuery);

            return(Ok(result));
        }