public async Task <ScanToddler> UpdateScanToddler(long id, ScanToddler updatedScanToddler)
        {
            updatedScanToddler.Toddler = null;
            updatedScanToddler.Scan    = null;

            UriBuilder builder = new UriBuilder(ApiConstants.BaseApiUrl)
            {
                Path = ApiConstants.BaseApiUriPart + ApiConstants.PutScanToddlerEndpoint + id
            };

            return(await _genericRepository.PutAsync(builder.ToString(), updatedScanToddler));
        }
示例#2
0
        public IActionResult PutScanToddler(long id, ScanToddler scanToddler)
        {
            if (id != scanToddler.ToddlerId)
            {
                return(BadRequest());
            }

            if (!_unitOfWork.ScanToddlerRepository.ScanToddlerExists(id))
            {
                return(NotFound());
            }

            try
            {
                _unitOfWork.ScanToddlerRepository.Update(scanToddler);
                _unitOfWork.SaveChanges();
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }

            return(NoContent());
        }
 public void Update(ScanToddler updatedScanToddler)
 {
     _context.ScanToddlers.Update(updatedScanToddler);
 }