public async Task <Graduate> Update(GraduateDto graduateDto) { Graduate graduate = await _graduateRepository.GetAllById(graduateDto.GraduateId); _mapper.Map(graduateDto, graduate); graduate.Validate(graduate, new GraduateValidator()); _notifications.AddNotifications(graduate.ValidationResult); foreach (var item in graduate.Address) { item.Validate(item, new AddressValidator()); _notifications.AddNotifications(item.ValidationResult); } foreach (var item in graduate.Phone) { item.Validate(item, new PhoneValidator()); _notifications.AddNotifications(item.ValidationResult); } if (!_notifications.HasNotifications) { await Put(graduate); } return(graduate); }
public async Task <IActionResult> Put([FromBody] GraduateDto graduateDto) { _ = await _graduateService.Update(graduateDto); return(Response(graduateDto.GraduateId)); }