public async Task <ActionResult <Workshop> > UpdateWorkshop([FromRoute] int workshopId, [FromBody] WorkshopUpdateDto updatedWorkshop) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Workshop workshop = await _workshopRepo.GetByIdAsync(workshopId); if (workshop == null) { return(NotFound(new { error = $"workshop with id {workshopId} could not be found" })); } else { workshop.BuildingNumber = updatedWorkshop.BuildingNumber; workshop.City = updatedWorkshop.City; workshop.Name = updatedWorkshop.Name; workshop.PostalCode = updatedWorkshop.PostalCode; workshop.Street = updatedWorkshop.Street; await _workshopRepo.UpdateAsync(workshop); return(Ok(workshop)); } }