Esempio n. 1
0
        public Mapuser FindUser(string userEmail)
        {
            using (var db = new mapContext())
            {
                try
                {
                    var me = db.Mapuser
                             .Include(ua => ua.Useractions)
                             .Single(u => u.Email.ToString() == userEmail);

                    if (me != null)
                    {
                        foreach (var a in me.Useractions)
                        {
                            db.Entry(a)
                            .Reference(act => act.Actions)
                            .Load();
                        }
                    }

                    return(me);
                }
                catch (System.Exception)
                {
                    return(null);
                }
            }
        }
Esempio n. 2
0
        public void ViaMapUsers()
        {
            using (var ctx = new mapContext())
            {
                var mapUsers = ctx.Mapuser
                               .Include(ua => ua.Useractions)
                               .ToList();

                foreach (var u in mapUsers)
                {
                    Console.WriteLine("User: "******"Action: " + act.Actions.Action);
                    }
                }
            }
        }