public async Task <ActionResult <Guid> > Post(CreateBatchUpdateJobRequest request)
        {
            try
            {
                var result = await this.batchUpdateJobsService.Create(request);

                var location = this.linkGenerator.GetPathByAction("Get", "BatchUpdateJobs", new { id = result.Id });
                return(Created(location, result));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Error creating batch update job. Inner exception: {ex}"));
            }
        }
Beispiel #2
0
        public async Task <BatchUpdateJobModel> Create(CreateBatchUpdateJobRequest request)
        {
            var model = this.mapper.Map <BatchUpdateJobModel>(request);
            var job   = this.mapper.Map <BatchUpdateJob>(model);

            this.iPAddressesRepository.Add(job);

            if (await this.iPAddressesRepository.SaveChangesAsync())
            {
                return(this.mapper.Map <BatchUpdateJobModel>(job));
            }
            else
            {
                throw new DbUpdateException();
            }
        }