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

namespace WK_KLI_LAPS_Service.Controllers.Master.Skill
{

    public interface ISkillService
    {
        object GetAll();
        object GetActiveSkill();
        int Add(skillModel data);
        int Edit(skillModel data);
        int Delete(skillModel data);
    }
    public class SkillService : ISkillService
    {
        MasterRepository oMasterRepository = new MasterRepository();

        public int Add(skillModel data)
        {
            if (string.IsNullOrEmpty(data.skillname))
                throw new Exception("Value should not be empty");
            int retval = oMasterRepository.add(data, "skill");
            return retval;
        }

        public int Delete(skillModel data)
        {
            int retval = oMasterRepository.Delete(data, "skill");
            return retval;
        }

        public int Edit(skillModel data)
        {
            if (string.IsNullOrEmpty(data.skillname))
                throw new Exception("Value should not be empty");
            int retval = oMasterRepository.Edit(data, "skill");
            return retval;
        }

        public object GetActiveSkill()
        {
            return oMasterRepository.GetActive("skill");
        }

        public object GetAll()
        {
            return oMasterRepository.GetAll("skill");
        }
    }
}
