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

namespace WK_KLI_LAPS_Service.Controllers.Master.Lob
{
    public interface ILobService
    {
        object GetAll();
        object GetActiveLob();
        object Edit_Lob(lobModel data);
        object Add_Lob(lobModel data);
        object Active_Lob(lobModel data);
        object Get_Loblst();
        /* object Get_Errorlst(string input);*/


    }
    public class LobService : ILobService
    {
        MasterRepository oMasterRepository = new MasterRepository();

        public object Active_Lob(lobModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.ExcecuteSP("splobmaster", input, "activeordeactive");
        }

        public object Add_Lob(lobModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            var res = oMasterRepository.ExcecuteSP("splobmaster", input, "insert");
            return res;
        }

        public object Edit_Lob(lobModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.ExcecuteSP("splobmaster", input, "update");
        }

        public object GetAll()
        {
            return oMasterRepository.ExcecuteSP("splobmasterselect", "", "getall");
        }
        //code to retrieve list of active records
        public object GetActiveLob()
        {
            return oMasterRepository.ExcecuteSP("splobmasterselect", "", "getactive");
        }

        /*    public object Get_Errorlst(string input)
            {
                return oMasterRepository.Master_Frequency("sperrormasterselect",input, "getlist");
            }*/
        public object Get_Loblst()
        {
            return oMasterRepository.ExcecuteSP("splobmasterselect", "", "getlist");
        }
    }
}
