Ejemplo n.º 1
0
        public async Task <ServiceAllowRule> CreateServiceAllowRule(ServiceAllowRule serviceAllowRule)
        {
            var instance = ef.ServiceAllowRule.FromDomain(serviceAllowRule);

            _context.ServiceAllowRule.Add(instance);
            await _context.SaveChangesAsync();

            await UpdateProxyServerAllowRules(await GetService(serviceAllowRule.ServiceId));

            return(await GetServiceAllowRule(instance.Id));
        }
Ejemplo n.º 2
0
        public async Task <ServiceAllowRule> UpdateServiceAllowRule(ServiceAllowRule serviceAllowRule)
        {
            var instance = await _context.ServiceAllowRule.SingleOrDefaultAsync(x => x.Id == serviceAllowRule.Id);

            instance.ServiceId = serviceAllowRule.ServiceId;
            instance.ServiceForwardTargetId = serviceAllowRule.ServiceForwardTargetId;
            instance.Type        = serviceAllowRule.Type;
            instance.Cidr        = serviceAllowRule.Cidr;
            instance.CidrGroupId = serviceAllowRule.CidrGroupId;
            instance.UserId      = serviceAllowRule.UserId;
            instance.UserGroupId = serviceAllowRule.UserGroupId;

            await UpdateProxyServerAllowRules(await GetService(serviceAllowRule.ServiceId));

            return(await GetServiceAllowRule(instance.Id));
        }
Ejemplo n.º 3
0
 public Task <ServiceAllowRule> UpdateServiceAllowRule(int serviceId, [FromBody] ServiceAllowRule allowRule)
 {
     return(_proxyService.UpdateServiceAllowRule(allowRule));
 }