示例#1
0
        public ActionResult Edit(int id)
        {
            GameModel gamemodel = db.GameModels.Find(id);

            GameModificationViewModel viewModel = new GameModificationViewModel()
            {
                Name = gamemodel.Name,
                GameId = gamemodel.GameId,
            };

            return View(viewModel);
        }
示例#2
0
        public ActionResult Edit(GameModificationViewModel gamemodel)
        {
            using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew))
            {
                try
                {
                    var editGame = new EditGame(gamemodel, db);
                    editGame.DoTransaction();

                    transactionScope.Complete();
                }
                catch (Exception e)
                {
                    ModelState.AddModelError("", "Change set is corrupted or someone modified model in same time");
                    return View(gamemodel);
                }
            }

            return RedirectToAction("Index");
        }
示例#3
0
 public EditGame(GameModificationViewModel gameModel, GameContext db)
 {
     this.gameModel = gameModel;
     this.db = db;
 }