public async Task <IHttpActionResult> DeleteIPAddressRange(int id) { WhitelistIP whitelistIP = await db.WhitelistIPs.FindAsync(id); if (whitelistIP == null) { return(NotFound()); } db.WhitelistIPs.Remove(whitelistIP); await db.SaveChangesAsync(); IPAddressRange iPAddressRange = new IPAddressRange { Id = whitelistIP.Id, StartAddress = whitelistIP.StartIP.IPAddressToString(), EndAddress = whitelistIP.EndIP.IPAddressToString(), IsActive = whitelistIP.IsActive, RuleName = whitelistIP.RuleName }; MemoryCacher.DeleteIfContains(iPAddressRange); return(Ok(iPAddressRange)); }