Exemplo n.º 1
0
        public void TestMethod1()
        {
            Database.SetInitializer(new DropCreateDatabaseAlways <LessonContext>());

            var            db    = new LessonContext();
            VocabularyItem vItem = new VocabularyItem
            {
                Word                 = "mouse",
                Translation          = "mysz",
                TranslateSuggestions = new List <TranslateSuggestion> {
                    new TranslateSuggestion {
                        Suggestion = "kon"
                    },
                    new TranslateSuggestion {
                        Suggestion = "pies"
                    },
                    new TranslateSuggestion {
                        Suggestion = "mysz"
                    }
                }
            };

            db.VocabularyItems.Add(vItem);
            db.SaveChanges();
        }
Exemplo n.º 2
0
        public JsonResult Lessons(string UserName, string Sifre)
        {
            List <Lesson> lessons = new List <Lesson>();

            using (SqlConnection conn = createConnection())
            {
                SqlCommand cmd = new SqlCommand("select * from Lessons l inner join PersonLessons pl on l.Id = pl.Lesson_Id inner join People p on p.Id = pl.Person_Id where p.UserName=@username and p.Password=@Sifre", conn);
                cmd.Parameters.AddWithValue("@username", UserName);
                cmd.Parameters.AddWithValue("@Sifre", Sifre);

                using (SqlDataReader result = cmd.ExecuteReader())
                {
                    while (result.Read())
                    {
                        Lesson ders = new Lesson
                        {
                            Id          = (int)result["Id"],
                            Name        = result["Name"].ToString(),
                            HourPerWeek = (int)result["HourPerWeek"]
                        };
                        lessons.Add(ders);
                    }
                }
                conn.Close();
            }
            var context = new LessonContext();



            return(Json(lessons, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        // GET: User
        public ActionResult Login()
        {
            var           context = new LessonContext();
            List <Person> Person  = context.Person.ToList();

            return(View(Person));
        }
Exemplo n.º 4
0
 public HomeController(SignInManager <SchoolUser> signInManager,
                       LessonContext context,
                       IHostingEnvironment ev, RoleManager <IdentityRole> roleManager)
 {
     _signInManager = signInManager;
     _context       = context;
     _ev            = ev;
     _roleManager   = roleManager;
 }
Exemplo n.º 5
0
        public UsersController(LessonContext context)
        {
            _context = context;
            _context.SaveChanges();
            if (_context.Users.Count() == 0)
            {
                User user1 = new User();
                user1.Id            = 1;
                user1.Username      = "******";
                user1.Firstname     = "Shaneal";
                user1.Lastname      = "Prasad";
                user1.Email         = "*****@*****.**";
                user1.Password      = "******";
                user1.ProfilePic    = "https://static-resource.np.community.playstation.net/avatar/3RD/30004.png";
                user1.Online        = false;
                user1.Friends       = new List <User>();
                user1.Notifications = new List <Notification>();
                user1.Favorites     = new List <Favorite>();
                user1.AboutMe       = "Full Stack Software Developer that enjoys conquering unique problems using technologies like HTML, CSS,Javascript, jQuery, Bootstrap, AngularJS, C# , ASP.NET, and Entity Framework.";

                User user2 = new User();
                user2.Id            = 2;
                user2.Username      = "******";
                user2.Firstname     = "Chance";
                user2.Lastname      = "Hernandez";
                user2.Email         = "*****@*****.**";
                user2.Password      = "******";
                user2.ProfilePic    = "http://www.psnleaderboard.com/images/avatars/E0004.png";
                user2.Online        = false;
                user2.Friends       = new List <User>();
                user2.Notifications = new List <Notification>();
                user2.Favorites     = new List <Favorite>();
                user2.AboutMe       = "I am a full stack developer with experience working with: Front end technologies such as HTML, CSS, and JavaScript | Back end technologies such as C#, ASP.NET and SQL | Frameworks such as Bootstrap, jQuery, and AngularJS";

                User user3 = new User();
                user3.Id            = 3;
                user3.Username      = "******";
                user3.Firstname     = "Brian";
                user3.Lastname      = "canlas";
                user3.Email         = "*****@*****.**";
                user3.Password      = "******";
                user3.ProfilePic    = "http://www.psnleaderboard.com/images/avatars/E0004.png";
                user3.Online        = false;
                user3.Friends       = new List <User>();
                user3.Notifications = new List <Notification>();
                user3.Favorites     = new List <Favorite>();
                user3.AboutMe       = "I am a Fullstack Developer with experience in working with front end technologies: HTML, CSS, Bootsrap, JavaScript, jQuery, AngularJS, and React. As well as experience in back end technologies: C#, ASP.NET, Node.Js , Restful API's, Mongo DB, and SQL Server.";

                _context.Users.Add(user1);
                _context.Users.Add(user2);
                _context.Users.Add(user3);
                _context.SaveChanges();
            }
        }
Exemplo n.º 6
0
        public TimeTableController(LessonContext context, IMemoryCache cache, IGetFirstDate getFirstDate)
        {
            _Context = context;
            _Cache   = cache;
            string stringDate;

            if (!_Cache.TryGetValue("FirstDate", out stringDate))
            {
                _Cache.Set("FirstDate", getFirstDate.GetDate("М4О-209Б-17").Result.ToString("d", System.Globalization.CultureInfo.CreateSpecificCulture("es-ES")));
            }
        }
Exemplo n.º 7
0
        public UsersController(LessonContext context)
        {
            _context = context;
            _context.SaveChanges();
            if (_context.Users.Count() == 0)
            {
                User user1 = new User();
                user1.Id         = 1;
                user1.Username   = "******";
                user1.Firstname  = "Shaneal";
                user1.Lastname   = "Prasad";
                user1.Email      = "*****@*****.**";
                user1.Password   = "******";
                user1.ProfilePic = "https://static-resource.np.community.playstation.net/avatar/3RD/30004.png";
                user1.Friends    = new List <User>();

                User user2 = new User();
                user2.Id         = 2;
                user2.Username   = "******";
                user2.Firstname  = "Chance";
                user2.Lastname   = "Hernandez";
                user2.Email      = "*****@*****.**";
                user2.Password   = "******";
                user2.ProfilePic = "http://www.psnleaderboard.com/images/avatars/E0004.png";
                user2.Friends    = new List <User>();

                User user3 = new User();
                user3.Id         = 3;
                user3.Username   = "******";
                user3.Firstname  = "Spiritual";
                user3.Lastname   = "Leader";
                user3.Email      = "*****@*****.**";
                user3.Password   = "******";
                user2.ProfilePic = "http://www.psnleaderboard.com/images/avatars/E0004.png";
                user3.Friends    = new List <User>();

                _context.Users.Add(user1);
                _context.Users.Add(user2);
                _context.Users.Add(user3);

                _context.SaveChanges();
            }
        }
 public ProductsController(LessonContext context)
 {
     _context = context;
     _context.SaveChanges();
 }
 public NotificationsController(LessonContext context)
 {
     _context = context;
     _context.SaveChanges();
 }
Exemplo n.º 10
0
 public FriendsController(LessonContext context)
 {
     _context = context;
     _context.SaveChanges();
 }
Exemplo n.º 11
0
 public GameStateController(LessonContext context)
 {
     _context = context;
 }
Exemplo n.º 12
0
 public DirectMessagesController(LessonContext context)
 {
     _context = context;
     _context.SaveChanges();
 }
 public DataController(LessonContext context)
 {
     LessonsDb = new LessonsDataBase(context);
 }
Exemplo n.º 14
0
 public ClansController(LessonContext context)
 {
     _context = context;
     _context.SaveChanges();
 }
Exemplo n.º 15
0
 public DataAddCheckAttribute(LessonContext Context)
 {
     _DbContext = Context;
 }
Exemplo n.º 16
0
 public AccountController(LessonContext context)
 {
     _context = context;
 }
Exemplo n.º 17
0
 public GameListController(LessonContext context)
 {
     _context = context;
 }
Exemplo n.º 18
0
 public DeleteFriendController(LessonContext context)
 {
     _context = context;
 }
Exemplo n.º 19
0
 public AdminController(LessonContext context, IHostingEnvironment ev)
 {
     _context = context;
     _ev      = ev;
 }
Exemplo n.º 20
0
 public ModeratorController(LessonContext context, IWebHostEnvironment appEnvironment, UserManager <User> userManager) // конструктор
 {
     db = context;
     _appEnvironment = appEnvironment;
     _users          = userManager;
 }
Exemplo n.º 21
0
 public VideoController(LessonContext context)
 {
     _context = context;
     _context.SaveChanges();
 }