Beispiel #1
0
 public OrderPageTabVM(OrderUser o, string currency)
 {
     Id = o.OrderId;
     if (o.UserProfile != null)
     {
         User = new UserTabVM(o.UserProfile, o.UserProfile.Sex, o.UserProfile.File);
     }
     OrderItems = o.Order.OrderItems.Where(m => m.UserId == User.UserProfileId).Select(m => new OrderItemVM(m, currency)).ToList();
 }
 public FeedbackVM(Feedback m, UserProfile p, List <FileModel> photos)
 {
     if (m != null)
     {
         Id      = m.Id;
         Stars   = m.Stars;
         Comment = m.Comment;
         if (p != null)
         {
             User = new UserTabVM(p, p.Sex, p.File);
         }
         if (photos != null && photos.Any())
         {
             Photos = photos?.Select(e => new IconVM(e.Id, $"{e.Path}{e.Name}{e.Extension}")).ToList();
         }
     }
 }
        public OrderPageVM(Order o)
        {
            Id          = o.Id;
            WelcomeCode = o.WelcomeCode;
            IsActive    = o.IsActive;
            StartDate   = o.StartDate;
            if (o.Location != null)
            {
                Currency = o.Location.Currency;
                EndDate  = o.EndDate;
                if (o.TableId != null)
                {
                    TableId = o.TableId.Value;
                }

                TableNumber = o.Table?.Number.ToString();
                if (o.Table?.LocationId != null)
                {
                    LocationId = (int)o.Table?.LocationId.Value;
                }

                if (o.Table != null && o.Table.Location != null)
                {
                    LocationName = o.Table.Location?.Name;
                    CompanyName  = o.Table.Location?.Company?.Name;
                    Address      = o.Table.Location?.Address;
                }

                if (o.Manager?.UserProfile != null)
                {
                    Manager     = new UserTabVM(o.Manager?.UserProfile, o.Manager?.UserProfile.Sex, o.Manager?.UserProfile.File);
                    ManagerName = $"{o.Manager.UserProfile.FirstName} {o.Manager.UserProfile.LastName[0]}.";
                }

                if (o.OrderUsers != null && o.OrderUsers.Any())
                {
                    Clients = o.OrderUsers.Select(m => new OrderPageTabVM(m, o.Location.Currency)).ToList();
                }
            }

            if (o.ManagerCalls != null && o.ManagerCalls.Any())
            {
                ManagerCalls = o.ManagerCalls.Select(m => new ManagerCallVM(m)).OrderBy(m => m.CallTime).Reverse().ToList();
            }
        }
Beispiel #4
0
 public TableBookVM(TableBook t)
 {
     Id        = t.Id;
     StartTime = t.StartTime;
     EndTime   = t.EndTime;
     BookTime  = t.BookTime;
     IsActive  = t.IsActive;
     Comment   = t.Comment;
     IsConfirm = t.IsConfirm;
     if (t.Table != null)
     {
         TableNumber = t.Table.Number;
         if (t.Table.Location != null)
         {
             LocationId   = t.Table.Location.Id;
             LocationName = t.Table.Location.Name;
         }
     }
     //if (t.Table != null) {Table = new TableTabVM(t.Table); }
     if (t.Client != null)
     {
         Client = new UserTabVM(t.Client, t.Client.Sex, t.Client.File);
     }
 }