Esempio n. 1
0
        public async Task <ActionResult <ZentrumDto> > GetTestCenter(int id)
        {
            ZentrumDto testCenter = await _unitOfWork.TestCenters.GetTestCenterDtoByIdAsync(id);

            if (testCenter == null)
            {
                return(NotFound());
            }

            return(Ok(testCenter));
        }
Esempio n. 2
0
 public async Task AddTestCenterAsync(ZentrumDto testCenter)
 {
     TestCenter center = new TestCenter
     {
         Name         = testCenter.Name,
         City         = testCenter.City,
         Postalcode   = testCenter.Postalcode,
         Street       = testCenter.Street,
         SlotCapacity = testCenter.SlotCapacity
     };
     await _dbContext.TestCenters.AddAsync(center);
 }
Esempio n. 3
0
        public async Task <ActionResult <TestCenter> > PostTestCenter(ZentrumDto testCenter)
        {
            await _unitOfWork.TestCenters.AddTestCenterAsync(testCenter);

            try
            {
                await _unitOfWork.SaveChangesAsync();
            }
            catch (ValidationException e)
            {
                return(BadRequest(e.Message));
            }
            return(NoContent());
            //return CreatedAtAction("GetTestCenter", new { id = testCenter.Id }, testCenter);
        }