Beispiel #1
0
 public async Task CreateOrUpdateJob(CreateOrUpdateJobInput input)
 {
     //if (input.Id.HasValue)
     //{
     //    await UpdateJobAsync(input);
     //}
     //else
     //{
     //    await CreateJobAsync(input);
     //}
     await _jobRepository.InsertOrUpdateAsync(input.MapTo <JobChance>());
 }
Beispiel #2
0
 public OutputBase CreateOrUpdateJob(CreateOrUpdateJobInput input)
 {
     if (input.Job.Id == 0)
     {
         return(CreateJob(Mapper.Map <CreateJobInput>(input.Job)));
     }
     if (_jobRepository.Query(q => q.Any(j => j.Title == input.Job.Title && j.Id != input.Job.Id)))
     {
         return(new OutputBase {
             Message = "A job with thesame title already added", Success = false
         });
     }
     _jobRepository.Update(Mapper.Map <Job>(input.Job));
     return(new OutputBase {
         Message = "Save scucceded", Success = true
     });
 }