public int AddDisablementIncapacityReason(DisablementIncapacityReason data)
        {
            var checkNumber = _context.DisablementIncapacityReason.Any(x => x.title == data.title);

            if (checkNumber)
            {
                return(-1);
            }
            var res = _context.DisablementIncapacityReason.Add(data);

            _context.SaveChanges();
            return(res.Entity.id);
        }
        public IActionResult PutDisablementIncapacityReason(int id, [FromBody] DisablementIncapacityReason data)
        {
            try
            {
                var res = _repository.UpdateDisablementIncapacityReason(id, data);

                if (!res)
                {
                    return(Conflict(409));
                }

                return(Ok(res));
            }
            catch (Exception error)
            {
                return(BadRequest(error));
            }
        }
        public IActionResult PostDisablementIncapacityReason(DisablementIncapacityReason data)
        {
            try
            {
                var res = _repository.AddDisablementIncapacityReason(data);

                if (res == -1)
                {
                    return(Conflict(409));
                }

                return(Ok(res));
            }
            catch (Exception error)
            {
                return(BadRequest(error));
            }
        }
        public bool UpdateDisablementIncapacityReason(int id, DisablementIncapacityReason data)
        {
            var res = _context.DisablementIncapacityReason.FirstOrDefault(x => x.id == id);

            if (res == null)
            {
                return(false);
            }
            var checkNumber = _context.DisablementIncapacityReason.Where(x => x.id != id).Any(x => x.title == data.title);

            if (checkNumber)
            {
                return(false);
            }
            res.title = data.title;
            _context.SaveChanges();
            return(true);
        }