private static Building SplitFlatsOnFlours(Building building) { var listFlats = building.Flats.OrderBy(a => a.CastSquare).ToList(); for (var j = 0; j < listFlats.Count; j += building.CountFloor) { var group = listFlats.GetRange(j, building.CountFloor); var max = group.Select(b => b.CastSquare).Max(); var number = 1; foreach (var flat in group) { //flat.Fine += Math.Round(max - flat.CastSquare, 2); flat.CastSquare = max; Floor.AddFlat(building, flat, number); number++; } } //добавление лестничной клетки на каждый этаж Floor.AddEntryway(building, Flat.CreateEntryway(building)); return(building); }