Example #1
0
 public IHttpActionResult Search(string query)
 {
     if (!string.IsNullOrEmpty(query) && query.Length > 1)
     {
         return(Ok(ControlCategoryService.Search(query)));
     }
     else
     {
         return(Ok(new List <SimpleSearchResult>()));
     }
 }
Example #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[] {});
        }
Example #3
0
 public IHttpActionResult Delete(int id)
 {
     ControlCategoryService.Delete(id);
     return(Ok());
 }
Example #4
0
 public IHttpActionResult Put([FromBody] Contracts.ControlCategory.UpdateControlCategory update)
 {
     ControlCategoryService.Update(update);
     return(Ok());
 }
Example #5
0
 public IHttpActionResult Post([FromBody] Contracts.ControlCategory.CreateControlCategory create)
 {
     ControlCategoryService.Create(create);
     return(Ok());
 }
Example #6
0
        public IHttpActionResult Get(int id)
        {
            var result = ControlCategoryService.GetSingle(id);

            return(Ok(result));
        }
Example #7
0
        public IHttpActionResult Get([FromUri] PagedQuery pagedQuery)
        {
            var result = ControlCategoryService.Get(pagedQuery);

            return(Ok(result));
        }