public JsonResult AddGame(long id) { BoardGameGeekInfo gameInfo = null; BoardGame game = new BoardGame(); try { gameInfo = bggInfoManager.LookUpBoardGame(id); } catch (Exception e) { return Json(e.Message, JsonRequestBehavior.AllowGet); } // Until custom name is set, use BGG's game.Name = gameInfo.Name; game.Id = Guid.NewGuid(); game.Rating = 0; game.Played = false; game.Owned = false; game.Comments = ""; game.Info = gameInfo; gameInfo.Id = Guid.NewGuid(); gameInfo.BoardGame = game; bggInfoManager.AddInfo(gameInfo); boardGameManager.AddGame(game); unitOfWork.Save(); return Json(game, JsonRequestBehavior.AllowGet); }
public void SaveGame(BoardGame game) { boardGameRepo.UpdateBoardGame(game); }
public void RemoveGame(BoardGame game) { boardGameRepo.DeleteBoardGame(game.Id); }
public void AddGame(BoardGame game) { boardGameRepo.InsertBoardGame(game); }
public void UpdateBoardGame(BoardGame game) { context.Entry(game).State = EntityState.Modified; }
public void InsertBoardGame(BoardGame game) { context.BoardGames.Add(game); }
public JsonResult SaveGame(BoardGame game) { boardGameManager.SaveGame(game); unitOfWork.Save(); return Json(true); }