public GamePlayerStatus(Player player) : this() { UserId = player.UserId; GameId = player.GameId; User = player.User; Game = player.Game; Player = player; }
public ActionResult Create(Player actionItem) { if (ModelState.IsValid) { context.Entry(actionItem).State = EntityState.Added; context.SaveChanges(); return RedirectToAction("Index"); } return View(actionItem); }
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); }
// 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>(); }
public ActionResult Edit(Player actionItem) { return View(actionItem); }
public ActionResult Delete(Player actionItem) { context.Entry(actionItem).State = EntityState.Deleted; context.SaveChanges(); return RedirectToAction("Index"); }