private HouseAppointmentDTO ToDTO(HouseAppointmentEntity houseApp) { HouseAppointmentDTO dto = new HouseAppointmentDTO(); //小区的名字通过预约看房的房子属性中的小区属性获得 dto.CommunityName = houseApp.House.Community.Name; dto.CreateDateTime = houseApp.CreateDateTime; dto.FollowAdminUserId = houseApp.FollowAdminUserId; //如果跟踪用户不为null if (houseApp.FollowAdminUser != null) { dto.FollowAdminUserName = houseApp.FollowAdminUser.Name; } dto.FollowDateTime = houseApp.FollowDateTime; dto.HouseId = houseApp.HouseId; dto.Id = houseApp.Id; dto.Name = houseApp.Name; dto.PhoneNum = houseApp.PhoneNum; //预约看房的房子在哪个区,也是通过导航属性获得 dto.RegionName = houseApp.House.Community.Region.Name; dto.Status = houseApp.Status; dto.UserId = houseApp.UserId; dto.VisitDate = houseApp.VisitDate; dto.HouseAddress = houseApp.House.Address; return(dto); }
public HouseAppointmentDTO DTO(HouseAppointmentEntity entity) { string adminUserName = ""; if (entity.FollowAdminUser != null) { adminUserName = entity.FollowAdminUser.Name; } HouseAppointmentDTO house = new HouseAppointmentDTO() { Id = entity.Id, VisitDate = entity.VisitDate, CreateDateTime = entity.CreateDateTime, HouseId = entity.HouseId, PhoneNum = entity.PhoneNum, Name = entity.Name, Status = entity.Status, UserId = entity.UserId, FollowAdminUserId = entity.FollowAdminUserId, FollowAdminUserName = adminUserName, CommunityName = entity.House.Community.Name, RegionName = entity.House.Community.Region.Name }; return(house); }
private HouseAppointmentDTO ToDTO(HouseAppointmentEntity houseApp) { HouseAppointmentDTO dto = new HouseAppointmentDTO(); dto.CommunityName = houseApp.House.Community.Name; dto.CreateDateTime = houseApp.CreateDateTime; dto.FollowAdminUserId = houseApp.FollowAdminUserId; if (houseApp.FollowAdminUser != null) { dto.FollowAdminUserName = houseApp.FollowAdminUser.Name; } dto.FollowDateTime = houseApp.FollowDateTime; dto.HouseId = houseApp.HouseId; dto.Id = houseApp.Id; dto.Name = houseApp.Name; dto.PhoneNum = houseApp.PhoneNum; dto.RegionName = houseApp.House.Community.Region.Name; dto.Status = houseApp.Status; dto.UserId = houseApp.UserId; dto.VisitDate = houseApp.VisitDate; return(dto); }