예제 #1
0
        public static CabinResource FromData(Cabin data, bool includeRelated = false)
        {
            var resource = new CabinResource
            {
                Id   = data.Id,
                Name = data.Name
            };

            if (includeRelated)
            {
                resource.Kids = data.Kids.Select(k => KidResource.FromData(k)).ToList();
            }

            return(resource);
        }
예제 #2
0
        public static TransactionResource FromData(Transaction data, bool includeRelated = false)
        {
            var resource = new TransactionResource
            {
                Id        = data.Id,
                Type      = data.Type,
                Amount    = data.Amount,
                TimeStamp = data.TimeStamp,
                UserName  = data.UserName
            };

            if (includeRelated)
            {
                resource.Kid = KidResource.FromData(data.Kid);
            }

            return(resource);
        }