using Newtonsoft.Json;
using System;
using WK_KLI_LAPS_Service.App_Data;
using WK_KLI_LAPS_Service.Models.Master;

namespace WK_KLI_LAPS_Service.Controllers.Master.Chartvalue
{

    public interface IChartValuesService
    {
        object GetAll();
        object Getstagelst();
        object Active_ChartValues(chartvalueModel data);
        object Add_ChartValues(chartvalueModel data);
        object Edit_ChartValues(chartvalueModel data);
    }
    public class ChartValuesService : IChartValuesService
    {
        MasterRepository oMasterRepository = new MasterRepository();

        //code to retrieve list of all records
        public object GetAll()
        {
            return oMasterRepository.Master_Frequency("spchartvalueselect", "", "getall");
        }

        public object Getstagelst()
        {
            return oMasterRepository.Master_Frequency("spchartvalueselect", "", "getstagelst");
        }

        //code to activate or deactivate record
        public object Active_ChartValues(chartvalueModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.Master_Frequency("spchartvaluemaster", input, "activeordeactive");
        }

        public object Add_ChartValues(chartvalueModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            var res = oMasterRepository.Master_Frequency("spchartvaluemaster", input, "insert");
            return res;
        }

        public object Edit_ChartValues(chartvalueModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.Master_Frequency("spchartvaluemaster", input, "update");
        }

    }
}
