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

namespace SchedulerCustomEditor.Controllers
{
    public class EventController : ApiController
    {
        private SchedulerMeetingService meetingService;

        public EventController()
        {
            this.meetingService = new SchedulerMeetingService();
        }


        // GET api/<controller>/5
        public IEnumerable<MeetingViewModel> Get(int id)
        {
            var data = meetingService.GetAll().Where(m => m.Start.Year == id);
            return data;
        }

        public MeetingViewModel Post(MeetingViewModel meeting)
        {
            if (ModelState.IsValid)
            {
                meetingService.Insert(meeting, null);
            }

            return meeting;
        }

        //// 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)
        //{
        //}
    }
}