Esempio n. 1
0
        public static IEnumerable <User> Retrieve()
        {
            var result = new List <User>();

            using (var ctx = new SimpleBlogContext())
            {
                result = ctx.UserSet.ToList();
            }
            return(result);
        }
Esempio n. 2
0
        public static bool UserExists(string username)
        {
            bool result = false;

            using (var ctx = new SimpleBlogContext())
            {
                result = ctx.UserSet.Any(x => x.Username == username);
            }
            return(result);
        }
Esempio n. 3
0
        public static bool Save(User user)
        {
            bool result = false;

            using (var ctx = new SimpleBlogContext())
            {
                ctx.UserSet.Add(user);
                ctx.SaveChanges();
                result = true;
            }
            return(result);
        }