public JsonResult Put([FromBody] Family Family) { _service.Update(Family); return(new JsonResult(new { code = 20000 })); }
public void Should_Update_Family() { var existingFamilyId = GetFamilyFromParentId(1).Id; var updateFamilyDto = new UpdateFamilyDto { FamilyId = existingFamilyId, FatherId = 3, MotherId = 4, OtherDetails = "et ils eurent beaucoup d'enfants" }; _familyAppService.Update(updateFamilyDto); UsingDbContext(context => { var family = context.Families.FirstOrDefault(f => f.Id == existingFamilyId); family.ShouldNotBeNull(); family.FatherId.ShouldBe(updateFamilyDto.FatherId); family.MotherId.ShouldBe(updateFamilyDto.MotherId); family.OtherDetails.ShouldBe(updateFamilyDto.OtherDetails); }); }