using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using Microsoft.AspNetCore.Http;

using Microsoft.AspNetCore.Mvc;

 

namespace Core2WebAPI.Controllers

{

    [Produces("application/json")]

    [Route("api/AJAXWebService")]

    public class AJAXWebServiceController : Controller

    {

        List<String> quotelist = new List<String>();

        List<String> MessageList = new List<String>();

        private const int MAX = 10;

 

        [HttpGet("GetTime")]    // GET api/AJAXWebService/GetTime

        public String GetTime()

        {

            return DateTime.Now.ToString();

        }

 

        [HttpGet("GetQuote")]   // GET api/AJAXWebService/GetQuote

        public String GetQuote()

        {

            quotelist.Add("If luck shuts the door, you gotta come in through the window. --Doyle Brunson");

            quotelist.Add("Be the change you wish to see in the world. --Ghandi");

            quotelist.Add("Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. --Albert Einstein");

            quotelist.Add("An optimist may see a light where there is none, but why must the pessimist always run to blow it out? --Rene Descartes");

            quotelist.Add("Each problem that I solved became a rule, which served afterwards to solve other problems. --Rene Descartes");

            quotelist.Add("I never met a person I didn't like, but for you, I will make an exception. --Christopher M. Pascucci");

            quotelist.Add("A girl phoned me the other day and said... Come on over, there's nobody home. I went over. Nobody was home. --Rodney Dangerfield");

            quotelist.Add("A word to the wise ain't necessary - it's the stupid ones that need the advice. --Bill Cosby");

 

            Random rand = new Random();

            int num = rand.Next(0, 8);

 

            return quotelist[num].ToString();

        }

 

        [HttpGet("ConvertName/{name}")]    // GET api/AJAXWebService/ConvertName/stringToConvert

        public String ConvertName(String name)

        {

            String str = name.ToUpper();

            return str;

        }

    }

}