예제 #1
0
        public IHttpActionResult get(long objectId)
        {
            ObjectModel Myobject = Storage.getObject(objectId);

            if (Myobject != null)
            {
                return(Ok(Myobject));
            }
            else
            {
                return(NotFound());
            }
        }
예제 #2
0
        public IHttpActionResult CreatePolicy([FromBody] CreatePolicyModel policy)
        {
            if (policy.domainName.Equals(null) || policy.domainName == string.Empty)
            {
                return(BadRequest("enter a value for domain name"));
            }
            if (policy.policyName.Equals(null) || policy.policyName == string.Empty)
            {
                return(BadRequest("enter a value for domain name"));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            long        policyId = Storage.createPolicy(policy.domainName, policy.parentPolicyName, policy.policyName, policy.groups, policy.roles);
            ObjectModel pol      = Storage.getObject(policyId);

            return(CreatedAtRoute("GetPolicy", new { policyId = policyId }, pol));
        } //CreatePolicy