public async Task AddBuildingAsync(BuildingDto building) { var entry = building.ToEntry(); await _baseInfoContext.BuildingInfos.AddAsync(entry); await _baseInfoContext.SaveChangesAsync(); building.BuildingId = entry.BuildingId; }
public void BuildingDto_Map_To_Entry() { BuildingDto otdto = new BuildingDto { BuildingId = 1, Name = "gholam", NumberOfUnits = 4 }; BuildingInfo ow = otdto.ToEntry(); bool check = false; if (ow.BuildingId == otdto.BuildingId && ow.ApartmentCount == otdto.NumberOfUnits && otdto.Name == ow.BuildingName) { check = true; } Assert.IsTrue(check); }