public BioService.Person GetPersonProto(Person entity) { if (entity == null) return null; BioService.Person proto = new BioService.Person(); proto.Id = entity.Id; proto.Firstname = entity.First_Name_; proto.Lastname = entity.Last_Name_; proto.Gender = (BioService.Person.Types.Gender)entity.Gender; if (entity.Country != null) proto.Country = entity.Country; if (entity.City != null) proto.City = entity.City; if (entity.Comments != null) proto.Comments = entity.Comments; if (entity.Email != null) proto.Email = entity.Email; proto.Rights = (BioService.Person.Types.Rights)entity.Rights; if (entity.Date_Of_Birth.HasValue) proto.Dateofbirth = entity.Date_Of_Birth.Value.Ticks; if (entity.Thumbnail.HasValue) proto.Thumbnailid = entity.Thumbnail.Value; return proto; }
public Person GetPersonEntity(BioService.Person proto) { if (proto == null) return null; Person entity = new Person(); entity.Id = proto.Id; entity.First_Name_ = proto.Firstname; entity.Last_Name_ = proto.Lastname; entity.Gender = (byte)proto.Gender; entity.Country = proto.Country; entity.Email = proto.Email; entity.City = proto.City; entity.Comments = proto.Comments; entity.Rights = (byte)proto.Rights; DateTime dateofbirth = new DateTime(proto.Dateofbirth); if (dateofbirth > DateTime.MinValue && dateofbirth < DateTime.MaxValue) entity.Date_Of_Birth = dateofbirth; entity.Thumbnail = proto.Thumbnailid; return entity; }