using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using wispro.sp.entity;

namespace wispro.sp.api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CalMonthController : ControllerBase
    {
        spDbContext Context;

        public CalMonthController(spDbContext context)
        {
            Context = context;
        }

        public CalMonth GetHandlingMonth()
        {
            CalMonth calMonth= Context.CalMonths.Where<CalMonth>(c => c.Status != 4).FirstOrDefault();

            if(calMonth== null)
            {
                return null;
            }
            else
            {
                return calMonth;
            }
        }
    }
}
