Esempio n. 1
0
        public IActionResult DeleteJobCategory(int id)
        {
            if (id == 0)
            {
                return(BadRequest());
            }

            var jobCategoryToDelete = _jobCategoryRepository.GetJobCategoryById(id);

            if (jobCategoryToDelete == null)
            {
                return(NotFound());
            }

            _jobCategoryRepository.DeleteJobCategory(id);

            return(NoContent());//success
        }
Esempio n. 2
0
        public List <JobCategoryModel> DeleteJobCategory(JobCategoryModel model)
        {
            List <JobCategoryModel> jobCategories = null;

            try
            {
                _jobCategoryRepository.DeleteJobCategory(model.ID);
                jobCategories = GetAllJobCategoryList(model);
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "JobCategory", message);
                throw new Exception(ex.Message);
            }
            return(jobCategories);
        }