예제 #1
0
        public bool SpecificationValidateCombination(JobtitleSpecification model)
        {
            var  id = model.Id;
            bool check;

            if (id < 1)
            {
                check = context.JobtitleSpecification.Any(jt =>
                                                          jt.JobTitleId == model.JobTitleId &&
                                                          jt.LineId == model.LineId &&
                                                          jt.JobFunctionId == model.JobFunctionId &&
                                                          jt.LevelEduId == model.LevelEduId &&
                                                          !jt.DelDate.HasValue &&
                                                          jt.BusinessGroupId == businessGroupID);
            }
            else
            {
                check = context.JobtitleSpecification.Any(jt =>
                                                          jt.JobTitleId == model.JobTitleId &&
                                                          jt.LineId == model.LineId &&
                                                          jt.JobFunctionId == model.JobFunctionId &&
                                                          jt.LevelEduId == model.LevelEduId &&
                                                          (jt.Id != id) &&
                                                          !jt.DelDate.HasValue &&
                                                          jt.BusinessGroupId == businessGroupID);
            }
            return(check);
        }
예제 #2
0
        public IActionResult SpecificationValidateCombination([FromBody] CreateEditSpecificationViewModel model)
        {
            JobtitleSpecification entity = new JobtitleSpecification();

            _mapper.Map(model, entity);
            var isValid = _jobTitleProvider.SpecificationValidateCombination(entity);

            return(Ok(isValid));
        }
예제 #3
0
        public IActionResult AddSpecification([FromBody] CreateEditSpecificationViewModel jobSpecification)
        {
            if (jobSpecification is null)
            {
                return(BadRequest("Job Title is null."));
            }

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

            JobtitleSpecification entity = new JobtitleSpecification();

            _mapper.Map(jobSpecification, entity);
            _jobTitleProvider.AddSpecification(entity);
            if (entity.Id > 0)
            {
                _jobTitleProvider.UpdateListJobTitleSpecificationMajor(entity.Id, jobSpecification.Selected);
            }
            return(Ok(jobSpecification));
        }
예제 #4
0
 public int EditSpecification(JobtitleSpecification entity)
 {
     context.SbEdit(entity);
     return(context.SaveChanges());
 }
예제 #5
0
 public int AddSpecification(JobtitleSpecification entity)
 {
     context.SbAdd(entity);
     return(context.SaveChanges());
 }