Beispiel #1
0
        private UserObj GetOrCreateCreateUser(string username, InnerTrackContext db)
        {
            UserObj dbItem = db.Users.FirstOrDefault(u => u.Email == username);

            if (dbItem == null)
            {
                dbItem = new UserObj()
                {
                    Email     = username,
                    CreatedBy = "system",
                    CreatedOn = DateTime.Now
                };

                db.Users.Add(dbItem);

                db.SaveChanges();
            }

            return(dbItem);
        }
        private UserObj GetOrCreateCreateUser(string username, InnerTrackContext db)
        {
            UserObj dbItem = db.Users.FirstOrDefault(u => u.Email == username);
            if (dbItem == null)
            {
                dbItem = new UserObj()
                {
                    Email = username,
                    CreatedBy = "system",
                    CreatedOn = DateTime.Now
                };

                db.Users.Add(dbItem);

                db.SaveChanges();
            }

            return dbItem;
        }