コード例 #1
0
        public JsonResult Add(ScoreModel score)
        {
            using (var scoreRepository = new ScoreRepository())
            {
                scoreRepository.Add(new ScoreDTO {
                    FinalScore = score.FinalScore, StudentId = score.StudentId, SubjectId = score.SubjectId
                });
            }

            return(Json("ok"));
        }
コード例 #2
0
        public ActionResult Snake(int skor2)
        {
            //try
            //{
            AppUser kullanici = Session["girisyapan"] as AppUser;



            if (asRep.Any(x => x.AppUserID == kullanici.ID && x.Game == "Snake") == true)
            {
                AppUserScore varOlanKullaniciScore = asRep.Default(x => x.AppUserID == kullanici.ID && x.Game == "Snake");

                Score skor = sRep.Default(x => x.ID == varOlanKullaniciScore.ScoreID);
                if (skor2 > skor.ScoreValue)
                {
                    skor.ScoreValue = skor2;
                    sRep.Update(skor);
                }
                else
                {
                    ViewBag.gec = "Daha önceki skorunuzu geçemediniz. Oyun kaydedilmedi.";
                }
            }
            else
            {
                AppUserScore kullaniciScore = new AppUserScore();
                kullaniciScore.AppUserID = kullanici.ID;

                Score score = new Score();
                score.ScoreValue = skor2;
                sRep.Add(score);

                kullaniciScore.ScoreID = score.ID;
                kullaniciScore.Game    = "Snake";



                asRep.Add(kullaniciScore);
            }



            return(Json(new { result = 1, puan = skor2 }));
            //}
            //catch (Exception)
            //{

            //    return Json(new { result = 0 });
            //}
        }
コード例 #3
0
        private void AddScore(int gameId, string userId, int drinks)
        {
            Score score = scoreRepo.getByGameAndUser(gameId, userId);

            if (score == null)
            {
                scoreRepo.Add(new Score()
                {
                    gameId = gameId,
                    userId = userId,
                    score1 = drinks
                });
            }
            else
            {
                score.score1 += drinks;
                scoreRepo.Update(score);
            }
            scoreRepo.Save();
        }
コード例 #4
0
ファイル: studentService.cs プロジェクト: Dev597/myWebCourse
 public void SelectCourse(int id, int code)
 {
     scoreRepository.Add(id, code);
 }