예제 #1
0
        public async Task <ActionResult> Index()
        {
            _context.RemoveRange(_context.CozulenTest.Where(c => c.cozen.Contains("anonim")).ToList());
            _context.RemoveRange(_context.Istatistik.Where(c => c.cozen.Contains("anonim")).ToList());
            _context.SaveChanges();
            var currentUsername = HttpContext.Session.GetString("username");

            ViewData["username"] = currentUsername;
            var istatistikModels = await _context.Istatistik.Where(i => i.cozulen == currentUsername).ToListAsync();

            return(View(istatistikModels));
        }
예제 #2
0
        public async Task <ActionResult> GetTest()
        {
            // GetUser(userModel.kullaniciAdi);
            var boslink = _context.Testler.Where(t => t.TestLinki == null);

            _context.RemoveRange(boslink);
            _context.SaveChanges();
            var currentUsername = HttpContext.Session.GetString("username");

            ViewData["username"] = currentUsername;

            var testModel = await _context.Testler.Where(t => t.TestSahibi.Equals(currentUsername)).ToListAsync();

            foreach (var a in testModel)
            {
                a.TestCozulmeSayisi = _context.CozulenTest.Where(c => c.testId == a.TestId).Count();
            }

            _context.SaveChanges();
            if (currentUsername == null)
            {
                return(RedirectToAction("noLogin", "Login", new { url = "http://kankammisin.tashteam/test/gettest" }));
            }
            var s = new HttpClient();

            return(View(testModel.ToList()));
        }
예제 #3
0
        public void TestSil(TestModel testModel)
        {
            c.Remove <TestModel>(testModel);
            var soru = c.Sorular.Where(s => s.testId == testModel.TestId).ToList();
            var ct   = c.CozulenTest.Where(ct => ct.testId == testModel.TestId).FirstOrDefault();
            var ista = c.Istatistik.Where(i => i.testAdi == testModel.TestAdi)
                       .Where(i => i.cozulen == testModel.TestSahibi).FirstOrDefault();

            c.RemoveRange(soru);
            if (ct != null)
            {
                c.Remove <CozulenTestModel>(ct);
                c.Remove <IstatistikModel>(ista);
            }

            c.SaveChanges();
        }