Beispiel #1
0
        public int UpdateCenter(Centers center)
        {
            var output = 0;

            Utilities.Try(() =>
            {
                output = _centerRepo.UpdateCenter(center);
            }, "UpdateCenter(Centers center)", log);
            return(output);
        }
        public async Task <IActionResult> UpdateCenter(Guid centerId, CenterForUpdateDto centerForUpdate)
        {
            var center = await _centerRepository.GetCenterByIdAsync(centerId);

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

            // map the entity to the courseForUpdateDto
            // apply the updated fields value to that Dto
            // map the courseForUpdateDto back to an entity
            _mapper.Map(centerForUpdate, center);

            _centerRepository.UpdateCenter(center);
            await _centerRepository.SaveChangesAsync();

            return(NoContent());
        }