Ejemplo n.º 1
0
        public void OnCompletingQuest(int questID, string userID)
        {
            UserInfo currentUser = userRepository.FirstOrDefault(x => x.UserID == userID);
            Quest    quest       = questRepository.FirstOrDefault(x => x.ID == questID);

            if (currentUser != null && quest != null)
            {
                currentUser.Experience = currentUser.Experience + quest.Points;
            }
        }
Ejemplo n.º 2
0
        public void EditQuest(int questID, string name, string desc, bool completed,
                              int questType, int scenarioID, System.DateTime dueDate,
                              System.DateTime doneDate, int points, Nullable <decimal> latitude = null,
                              Nullable <decimal> longitude = null)
        {
            Quest questToEdit = questRepository.FirstOrDefault(x => x.ID == scenarioID);

            questToEdit.Name        = name;
            questToEdit.Description = desc;
            questToEdit.Completed   = completed;
            questToEdit.QuestTypeID = questType;
            questToEdit.ScenarioID  = scenarioID;
            questToEdit.DueDate     = dueDate;
            questToEdit.DoneDate    = doneDate;
            questToEdit.Latitude    = latitude;
            questToEdit.Longitude   = longitude;
            questToEdit.Points      = points;

            questRepository.SaveChanges();
        }