예제 #1
0
 // POST: api/Mafia
 public void Post(Game game)
 {
     if (MafiaRepo.IsIdUsed(game.Id))
     {
         MafiaRepo.DeleteGame(game.Id);
     }
     MafiaRepo.AddGame(game);
 }
예제 #2
0
        /// <summary>
        /// This method returns records gotten from DB matching users phone number
        /// </summary>
        /// <param name="tell"></param>
        /// <returns></returns>
        public ReturnMessage UpdateGameUserLastAccess(string tell, GameData.Game game)
        {
            ReturnMessage returnMessage;

            if (tell.Trim() != game.MSISDN.Trim())
            {
                return(returnMessage = new ReturnMessage()
                {
                    Message = "Record Mismatch",
                    Success = false
                });
            }

            try
            {
                //Update Last Access DateTime to Today
                game.LastAccess = DateTime.Today;

                _NGSubscriptionsEntities.Entry(game).State = EntityState.Modified;
                var retVal = _NGSubscriptionsEntities.SaveChanges();
                return(returnMessage = new ReturnMessage()
                {
                    ID = retVal,
                    Message = "Operation Successful",
                    Success = true,
                    Data = game
                });
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SubscriberExists(tell))
                {
                    return(returnMessage = new ReturnMessage()
                    {
                        Message = "Record Not Found",
                        Success = false
                    });
                }
                else
                {
                    throw;
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Method to add new Subscriber to DB
 /// </summary>
 /// <param name="t">User's Telephone Number</param>
 /// <param name="sT">Users selected Subscription Type</param>
 /// <returns></returns>
 public int PostNewSubscriber(GameData.Game game)
 {
     try
     {
         //Check if User already exists in DB
         if (SubscriberExists(game.MSISDN))
         {
             _NGSubscriptionsEntities.Entry(game).State = EntityState.Modified;
         }
         else
         {
             _NGSubscriptionsEntities.Games.Add(game);
         }
         var retVal = _NGSubscriptionsEntities.SaveChanges();
         return(retVal);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public void AddGame(Game game)
 {
     _repo.Add<Game>(game);
 }
예제 #5
0
파일: Card.cs 프로젝트: Samoustique/Bang
 private void HandleCardNotPlayable(Game.CardPlayedResult res)
 {
     Debug.Log("Illegal move : " + res);
 }