public async Task <ResponseKingdomDto> ModifyKingdom(RequestKingdomDto kingdomDto) { if (!string.IsNullOrEmpty(kingdomDto.Name)) { currentkingdom.Name = kingdomDto.Name; } if (kingdomDto.Location != null) { currentkingdom.Location = kingdomDto.Location; } if (!string.IsNullOrEmpty(kingdomDto.Name) || kingdomDto.Location != null) { dbContext.Kingdoms.Update(currentkingdom); await dbContext.SaveChangesAsync(); } return(new ResponseKingdomDto(currentkingdom)); }
public async Task <IActionResult> ModifyKingdom([FromBody] RequestKingdomDto kingdomDto) { var kingdom = await kingdomService.ModifyKingdom(kingdomDto); return(Ok(kingdom)); }