public void GetBirdObservationReport()
        {
            List <string> observationList = BirdWatchLogFile.ReadObservations();

            JavaScriptSerializer jsonStream = new JavaScriptSerializer();

            Context.Response.Write(jsonStream.Serialize(observationList));
        }
        public void IncrementBirdObservations(string birdName)
        {
            List <BirdWatchItem> birdList = BirdWatchDataFile.Read();

            for (int i = 0; i < birdList.Count; i++)
            {
                if (birdList[i].BirdName == birdName)
                {
                    birdList[i].IncrementBirdObservations();
                    break;
                }
            }

            BirdWatchLogFile.Write(birdName, birdList);
            BirdWatchDataFile.Write(birdList);
        }
        public string AddNewBirdItem(string birdName)
        {
            List <BirdWatchItem> birdList   = BirdWatchDataFile.Read();
            JavaScriptSerializer jsonStream = new JavaScriptSerializer();

            // Validate
            if (string.IsNullOrEmpty(birdName) || !Regex.IsMatch(birdName, @"^[a-öA-Ö]+$"))
            {
                return("Virhe: virheellinen linnun nimi");
            }

            for (int i = 0; i < birdList.Count; i++)
            {
                if (birdList[i].BirdName == birdName)
                {
                    return("Virhe: yritit lisätä duplikaattia");
                }
            }

            birdList.Add(new BirdWatchItem(birdName, 0));
            BirdWatchLogFile.Write(birdName);
            BirdWatchDataFile.Write(birdList);
            return(string.Empty);
        }