Ejemplo n.º 1
0
 public OutputBase CreateOrUpdateJobCategory(CreateOrUpdateJobCategoryInput input)
 {
     if (
         _jobCategoryRepository.Query(
             q => q.Any(jc => jc.Name == input.JobCategory.Name && jc.Id != input.JobCategory.Id)))
     {
         return(new OutputBase {
             Message = "A category with the same already added", Success = false
         });
     }
     if (input.JobCategory.Id == 0)
     {
         _jobCategoryRepository.Insert(Mapper.Map <JobCategory>(input.JobCategory));
     }
     else
     {
         _jobCategoryRepository.Update(Mapper.Map <JobCategory>(input.JobCategory));
     }
     return(new OutputBase {
         Message = "Category saved", Success = true
     });
 }