Пример #1
0
        public JobDetails Add(JobDetails JobDetails)
        {
            // retrieve the JobType so we can check
            var JobType = _JobTypeRepo.Get(JobDetails.JobTypeId);

            // for a DurationAndDistance JobDetails, you must supply a Distance
            if (JobType.RecordType == RecordType.DurationAndDistance &&
                JobDetails.Distance <= 0)
            {
                throw new ApplicationException("You must supply a Distance for this JobDetails.");
            }
            if (JobDetails.Duration <= 0)
            {
                throw new ApplicationException("You must supply a duration for this JobDetails.");
            }
            _JobDetailsRepo.Add(JobDetails);
            return(JobDetails);
        }
Пример #2
0
 public JobType Get(int id)
 {
     // get activity type by id
     return(_JobTypeRepo.Get(id));
 }
 public async Task <ActionResult <ICollection <JobTypeDto> > > Index()
 {
     return(Ok(await _repository.Get()));
 }