using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using MvcWriter.Models;

namespace MvcWriter.Services
{
    public class WebAPIController : ApiController
    {
        // GET api/<controller>
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/<controller>/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/<controller>
        public void Post([FromBody]string value)
        {
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
        }

        //public List<WriterModel> GetwriterData()
        //{
        //    List<WriterModel> writerList = new List<WriterModel>();
        //    for (int i = 0; i <= 100; i++)
        //    {
        //        WriterModel model = new WriterModel();
        //        model.writerID = i;
        //        model.Code = "code" + i;
        //        model.Name = "Name" + i;
        //        model.IsActive = (i % 2 == 0);


        //        List<Agent> agents = new List<Agent>();
        //        for (int j = 0; j < 20; j++)
        //        {
        //            Agent agent = new Agent();
        //            agent.AgentID = "Agency" + j;
        //            agent.Name = "Name-" + i + "_" + j;
        //            agent.IsActive = (j % 2 == 0);

        //            agents.Add(agent);
        //        }

        //        model.Agents = agents;
        //        writerList.Add(model);
        //    }
        //    return writerList;
        //}

        public List<WriterModel> GetWriterData()
        {
            return NDatabaseIO.WriterData.ReadWriters();
        }

        public bool POSTaddwriterData(Object Data)
        {
            int i = 0;

            return true;
        }

        public bool POSTwriterData(Object Data)
        {
            int i = 0;

            return true;
        }
    }
}