public static void LogApiRequest(int apiId, string apiUrl, IPAddress ip) { using (var db = new ApifoxContext()) { db.ApiRequests.Add(new ApiRequests { ApiId = apiId, ApiUrl = apiUrl, Ip = ip.ToString() }); db.SaveChanges(); } }
private static async Task AssociateApisToNewOwner(string userName, string oldUserName) { // Update apis owner var db = new ApifoxContext(); db.Apis.Where(x => x.Owner.Contains(oldUserName)) .ToList() .ForEach(a => a.Owner = userName); await db.SaveChangesAsync(); }