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

namespace WK_KLI_LAPS_Service.Controllers.Master.LobDetails
{
    public interface ILobDetailsService
    {
        object GetAll();
        object GetActiveLobDetails();
        object Edit_LobDetails(LobDetailesModel data);
        object Add_LobDetails(LobDetailesModel data);
        object Active_LobDetails(LobDetailesModel data);
        object Get_LobDetailslst(LobDetailesModel data);
        /* object Get_Errorlst(string input);*/


    }
    public class LobDetailsService : ILobDetailsService
{
        MasterRepository oMasterRepository = new MasterRepository();

        public object Active_LobDetails(LobDetailesModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.ExcecuteSP("splobdetailsmaster", input, "activeordeactive");
        }

        public object Add_LobDetails(LobDetailesModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            var res = oMasterRepository.ExcecuteSP("splobdetailsmaster", input, "insert");
            return res;
        }

        public object Edit_LobDetails(LobDetailesModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.ExcecuteSP("splobdetailsmaster", input, "update");
        }

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

        /*    public object Get_Errorlst(string input)
            {
                return oMasterRepository.Master_Frequency("sperrormasterselect",input, "getlist");
            }*/
        public object Get_LobDetailslst(LobDetailesModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.ExcecuteSP("splobdetailsmasterselect", input, "getlist");
        }
    }
}
