public static PetProfileContract ToContract(this PetProfileDto dto) { if (dto == null) { return(null); } return(new PetProfileContract { AvgLikeCount = dto.AvgLikeCount, Breed = dto.Breed, DateOfBirth = dto.DateOfBirth, Gender = dto.Gender, Img = dto.Img, IsReadyForSex = dto.IsReadyForSex, IsSale = dto.IsSale, IsShare = dto.IsShare, Location = dto.Location, Name = dto.Name, Type = dto.Type, Id = dto.Id }); }
public static PetProfile ToEntity(this PetProfileDto dto) { if (dto == null) { return(null); } return(new PetProfile { Id = dto.Id, OwnerId = dto.OwnerId, AvgLikeCount = dto.AvgLikeCount, Breed = dto.Breed, DateOfBirth = dto.DateOfBirth, Gender = string.IsNullOrEmpty(dto.Gender) ? null: (Genders?)Enum.Parse(typeof(Genders), dto.Gender), Img = dto.Img, IsReadyForSex = dto.IsReadyForSex, IsSale = dto.IsSale, IsShare = dto.IsShare, Location = dto.Location, Name = dto.Name, Type = dto.Type }); }