예제 #1
0
 public GamePlayerStatus(Player player)
     : this()
 {
     UserId = player.UserId;
     GameId = player.GameId;
     User = player.User;
     Game = player.Game;
     Player = player;
 }
예제 #2
0
        public ActionResult Create(Player actionItem)
        {
            if (ModelState.IsValid)
            {
                context.Entry(actionItem).State = EntityState.Added;
                context.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(actionItem);
        }
예제 #3
0
        public ActionResult PostEdit(Player actionItem)
        {
            if (ModelState.IsValid)
            {
            try
                {
                    //Player item = context.AllPlayers.First(e => e.Id == actionItem.Id);

                    // TODO: UPDATE FIELDS ON DB ENTITY
                    //context.Entry(item).State = EntityState.Modified;
                    //context.SaveChanges();
                }
                catch (InvalidOperationException)
                {
                    TempData["Message"] = "Your changes could not be saved... The item has probably been deleted in the meanwhile.";
                }
                return RedirectToAction("Index");
            }
            return View(actionItem);
        }
예제 #4
0
파일: Player.cs 프로젝트: JustynaJuza/Magic
 // Constructor.
 public PlayerViewModel(Player player)
 {
     User = player.User.GetViewModel();
     //Deck = (CardDeckViewModel) player.Deck.GetViewModel();
     HealthTotal = player.HealthTotal;
     HealthCurrent = player.HealthCurrent;
     //CardsInLibraryTotal = player.CardsInLibraryTotal;
     //CardsPlayed = player.CardsPlayed;
     Library = new List<CardViewModel>();
     Graveyard = new List<CardViewModel>();
     Exiled = new List<CardViewModel>();
     Battlefield = new List<CardViewModel>();
 }
예제 #5
0
 public ActionResult Edit(Player actionItem)
 {
     return View(actionItem);
 }
예제 #6
0
 public ActionResult Delete(Player actionItem)
 {
     context.Entry(actionItem).State = EntityState.Deleted;
     context.SaveChanges();
     return RedirectToAction("Index");
 }