Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            t_game_master t_game_master = db.t_game_master.Find(id);

            db.t_game_master.Remove(t_game_master);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "id,game_name,image,create_date")] t_game_master t_game_master)
 {
     if (ModelState.IsValid)
     {
         db.Entry(t_game_master).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(t_game_master));
 }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "id,game_name,image,create_date")] t_game_master t_game_master)
        {
            if (ModelState.IsValid)
            {
                db.t_game_master.Add(t_game_master);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(t_game_master));
        }
Beispiel #4
0
        // GET: GameMaster/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            t_game_master t_game_master = db.t_game_master.Find(id);

            if (t_game_master == null)
            {
                return(HttpNotFound());
            }
            return(View(t_game_master));
        }
Beispiel #5
0
        public JsonResult SaveGames(List <RootObject> data)
        {
            DateTime Now = DateTime.Now;

            string GameDayNamePrompt = (data[0].game_date.ToString("dddd",
                                                                   new CultureInfo("en-EN")));

            string GameDay = (data[0].game_date.ToString("dd"));

            string GameDayName = (data[0].game_date.ToString("dddd",
                                                             new CultureInfo("tr-TR")));

            string GameMonth = (data[0].game_date.ToString("MMMM",
                                                           new CultureInfo("tr-TR")));

            string FullGameDay = GameDay + " " + GameMonth + ", " + GameDayName;

            ////////////// SET GAME PREFERENCE //////////////////


            List <GAMEDETAIL> game_details = data[0].GAMEDETAIL;

            int    maxPossibility   = int.MinValue;
            string DetailPreference = "";

            foreach (GAMEDETAIL type in game_details)
            {
                int prefDetail = Convert.ToInt32(type.possibility);
                if (prefDetail > maxPossibility)
                {
                    maxPossibility = prefDetail;
                }
            }

            foreach (GAMEDETAIL obj in game_details)
            {
                if (obj.possibility == Convert.ToString(maxPossibility))
                {
                    DetailPreference = obj.preference;
                }
            }
            //////////////////////////////////////////////////////


            t_game_master _gamemaster = new t_game_master();

            _gamemaster.create_date     = Now;
            _gamemaster.id              = 0;
            _gamemaster.game_name       = data[0].game_name;
            _gamemaster.image           = data[0].image;
            _gamemaster.is_active       = data[0].is_active;
            _gamemaster.category        = data[0].category;
            _gamemaster.sub_category    = data[0].sub_category;
            _gamemaster.description     = data[0].description;
            _gamemaster.priority        = data[0].priority;
            _gamemaster.game_date       = data[0].game_date;
            _gamemaster.game_day_prompt = GameDayNamePrompt;
            _gamemaster.game_day        = FullGameDay;
            _gamemaster.game_preference = DetailPreference + " - " + Convert.ToString(maxPossibility);

            db.t_game_master.Add(_gamemaster);

            int GameId = _gamemaster.id;



            foreach (GAMEDETAIL obj in game_details)
            {
                t_game_detail _gamedetail = new t_game_detail();
                _gamedetail.game_id     = GameId;
                _gamedetail.preference  = obj.preference;
                _gamedetail.trust       = obj.trust;
                _gamedetail.ratio       = obj.ratio;
                _gamedetail.possibility = obj.possibility;
                _gamedetail.region      = obj.region;
                _gamedetail.game_code   = obj.game_code;


                db.t_game_detail.Add(_gamedetail);
            }

            db.SaveChanges();

            return(Json(true, JsonRequestBehavior.AllowGet));
        }