Пример #1
0
        public InviteServiceModel(BiteNet.LinqToSql.AccountInvite ltsInvite, string reasonOverride = null)
        {
            Exists = false;

            if (ltsInvite != null)
            {
                Exists = true;
                Used = ltsInvite.Used;
                CreationTime = ltsInvite.Creation.ToUnixEpochMilliseconds();
                Token = ltsInvite.Token;
                Reason = (reasonOverride == null) ? ltsInvite.Description : reasonOverride;
                Id = ltsInvite.Id;
            }

            Valid =  this.Exists && !this.Used;
        }
        public RestaurantFollowServiceModel(BiteNet.LinqToSql.RestaurantFollow ltsRestaurantFollow, BiteNet.LinqToSql.User poster, double distance)
        {
            this.Restaurant = new RestaurantInfoServiceModel(ltsRestaurantFollow.Restaurant);
            this.ExperienceText = ltsRestaurantFollow.ExperienceText;

            this.HasBite = true;

            if (poster != null)
            {
                this.FolloweeID = poster.Id;
                this.FolloweeUserName = poster.Username;
                this.HasBite = false;
            }

            this.Distance = Math.Round(distance); ;
            this.Id = ltsRestaurantFollow.Id;
            this.Date = ltsRestaurantFollow.CreationDate.HasValue ? ltsRestaurantFollow.CreationDate.Value.ToUnixEpochMilliseconds() : 0;
        }
        public RestaurantSearchServiceModel(BiteNet.LinqToSql.Restaurant ltsRestaurant, double distance)
        {
            //this.Address = BiteNet.Core.AddressProcessing.AddressLineOnly(ltsRestaurant.Address.PostalAddress);
            string address, city, state, zip;
            BiteNet.Core.AddressProcessing.ParseAddress(ltsRestaurant.Address.PostalAddress, out address, out city, out state, out zip);

            this.Address = address;
            this.City = city;
            this.State = state;
            this.Zip = zip;

            this.Latitude = ltsRestaurant.Address.Latitude;
            this.Longitude = ltsRestaurant.Address.Longitude;
            this.Distance = Math.Round(distance);

            this.Id = ltsRestaurant.Id;
            this.Name = ltsRestaurant.Name;

            this.Statistics = RestaurantStatisticsServiceModel.Create(ltsRestaurant);
        }
 public UserFollowServiceModel(BiteNet.LinqToSql.UserFollow ltsUserFollow)
 {
     FolloweeID = ltsUserFollow.FolloweeId;
     FolloweeUserName = ltsUserFollow.Followee.Username;
 }