Esempio n. 1
0
        public IActionResult CreateJobCategory([FromBody] JobCategory jobCategory)
        {
            if (jobCategory == null)
            {
                return(BadRequest());
            }

            if (jobCategory.JobCategoryName == string.Empty)
            {
                ModelState.AddModelError("JobCategoryName", "The Job Category Name Is Required!");
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var createdJobCategory = _jobCategoryRepository.AddJobCategory(jobCategory);

            return(Created("JobCategory", createdJobCategory));
        }