public static void MarkLog(string email) { using (var db = new ApplicationDbContext()) { var log = new UserLogs { UserId = db.Users.Where(u => u.Email.Equals(email)).Select(i => i.Id).First(), LoggedAt = DateTime.Now }; db.UserLogs.Add(log); db.SaveChanges(); } }