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); }
public IActionResult SpecificationValidateCombination([FromBody] CreateEditSpecificationViewModel model) { JobtitleSpecification entity = new JobtitleSpecification(); _mapper.Map(model, entity); var isValid = _jobTitleProvider.SpecificationValidateCombination(entity); return(Ok(isValid)); }
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)); }
public int EditSpecification(JobtitleSpecification entity) { context.SbEdit(entity); return(context.SaveChanges()); }
public int AddSpecification(JobtitleSpecification entity) { context.SbAdd(entity); return(context.SaveChanges()); }