Exemple #1
0
        public async Task <CidrGroup> CreateCidrGroup(CidrGroup cidrGroup)
        {
            var instance = ef.CidrGroup.FromDomain(cidrGroup);

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

            return(instance.ToDomain());
        }
Exemple #2
0
        public async Task <CidrGroup> UpdateCidrGroup(CidrGroup cidrGroup)
        {
            var instance = await _context.CidrGroup.SingleOrDefaultAsync(x => x.Id == cidrGroup.Id);

            instance.Name     = cidrGroup.Name;
            instance.CidrList = cidrGroup.CidrList;
            await _context.SaveChangesAsync();

            await _sp.GetService <ProxyService>().ReflashAllProxyServerAllowRules();

            return(instance.ToDomain());
        }
Exemple #3
0
 public Task <CidrGroup> UpdateCidrGroup([FromBody] CidrGroup cidrGroup)
 {
     return(_cidrGroupService.UpdateCidrGroup(cidrGroup));
 }