﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EmployeeMonthlyPayslip.Services;
using EmployeeMonthlyPayslip.Models;
using System.ComponentModel;

namespace EmployeeMonthlyPayslip.Controllers
{
    public class HomeController : Controller
    {
        [HttpGet]
        public ActionResult Index()
        {
            var model = new IndexModel();
            return View(model);
        }

        [HttpPost]
        public ActionResult Index(IndexModel model)
        {
            model.FeedbackMessage = "";
            var payslipService = new PayslipService();
            model.FeedbackMessage = payslipService.GenerateCsv();
            return View(model);
        }

        public ActionResult About()
        {
            ViewBag.Message = "How to generate employee monthly payslips.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "My contact details.";

            return View();
        }
    }
}