Пример #1
0
        public UserSerealizerBody GetUserInfoBuffered(string userId)
        {

            var user = DataManager.User.GetUserByIdBuffered(userId);
            string description = DataManager.User.GetUserDescriptionBuffered(userId);
            string address = string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority);
            UserSerealizerBody result = new UserSerealizerBody
            {
                Id = user.Id,
                Email = user.Email,
                Address = user.Address,
                Description = description,
                FirstName = user.FristName,
                Surname = user.Surname,
                Phone = user.PhoneNumber,
                Username = user.UserName,
                AvatarUrl = address + user.Avatar_Url
            };
            return result;
        }
Пример #2
0
 private OrderSerializerBody GetOrderInformation(order o)
 {
     string address = string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority);
     UserSerealizerBody cook = GetUserInfoBuffered(o.Id_Cook);
     aspnetuser cust = DataManager.User.GetUserByIdBuffered(o.Id_Customer);
     UserSerealizerBody customer = new UserSerealizerBody
     {
         Id = o.Id_Customer,
         Email = o.Email,
         Address = o.Address,
         FirstName = o.FirstName,
         Surname = o.Surname,
         Phone = o.Phone,
         Username = cust == null ? null : cust.UserName,
         AvatarUrl = cust == null ? null : (address + cust.Avatar_Url)
     };
     OrderSerializerBody res = new OrderSerializerBody
     {
         Comment = o.Comment,
         Comunication = o.ordercontactmethod.Name,
         Deadline = o.DeadLine == null ? null : ConvertToUnixTime((DateTime)o.DeadLine).ToString(),
         Delivery = o.orderdelivery.Name,
         FinishTime = o.FinishTime == null ? null : ConvertToUnixTime((DateTime)o.FinishTime).ToString(),
         Payment = o.orderpaymentmethod.Name,
         Status = o.orderstatu.Name,
         Cook = cook,
         Id_Order = o.Id_Order,
         Total = o.total,
         IngridientsBuyer = o.orderingridientbuyer.Name,
         Customer = customer
     };
     return res;
 }