Example #1
0
        public User(Protobuf.User userPb)
        {
            this.Id = userPb.Id;

            this.Email = userPb.Email;

            this.Password = userPb.Password.ToByteArray();

            this.Username = userPb.Username;

            this.UserPlan = (HashSet <UserPlan>)userPb.UserPlan.Select(up => new UserPlan(up));

            this.UserTicket = (HashSet <UserTicket>)userPb.UserTicket.Select(ut => new UserTicket(ut));
        }
Example #2
0
        public Protobuf.User ToPBMessage()
        {
            Protobuf.User userPb = new Protobuf.User();
            userPb.Id = this.Id;

            userPb.Email = this.Email;

            userPb.Password = Google.Protobuf.ByteString.CopyFrom(this.Password);

            userPb.Username = this.Username;

            userPb.UserPlan.AddRange(this.UserPlan.Select(up => up.ToPBMessage()));

            userPb.UserTicket.AddRange(this.UserTicket.Select(ut => ut.ToPBMessage()));

            return(userPb);
        }