示例#1
0
        public IList <ContractVM> GetVMs()
        {
            IEnumerable <Contract> contracts   = rep.Get(); // Get - async
            IList <ContractVM>     contractVMs = new List <ContractVM>();

            foreach (Contract c in contracts)
            {
                contractVMs.Add(new ContractVM
                {
                    Id                 = c.Id,
                    Contractors        = _db.Contractors.OrderByDescending(i => i.Id == c.SelectedContractorID).ThenBy(i => i).ToList(),
                    Statuses           = _db.DocumentStatuses.OrderByDescending(i => i.Id == c.StatusID).ThenBy(i => i).ToList(),
                    Note               = c.Note,
                    Number             = c.Number,
                    ParentDocumentLink = c.ParentDocumentLink,
                    Date               = c.Date
                });
            }
            return(contractVMs);
        }
示例#2
0
        public IList <ActVM> GetVMs()
        {
            IEnumerable <Act> acts   = rep.Get();
            IList <ActVM>     actVMs = new List <ActVM>();

            foreach (Act act in acts)
            {
                actVMs.Add(new ActVM
                {
                    Id                 = act.Id,
                    Contractors        = _db.Contractors.OrderByDescending(i => i.Id == act.SelectedContractorID).ThenBy(i => i).ToList(),
                    Statuses           = _db.DocumentStatuses.OrderByDescending(i => i.Id == act.StatusID).ThenBy(i => i).ToList(),
                    Note               = act.Note,
                    Number             = act.Number,
                    ParentDocumentLink = act.ParentDocumentLink,
                    Date               = act.Date
                });
            }
            return(actVMs);
        }
示例#3
0
        public IList <EmailVM> GetVMs()
        {
            IEnumerable <Email> emails   = rep.Get();
            IList <EmailVM>     emailVMs = new List <EmailVM>();

            foreach (Email email in emails)
            {
                emailVMs.Add(new EmailVM
                {
                    Id                 = email.Id,
                    From               = email.From,
                    To                 = email.To,
                    Date               = email.Date,
                    DateBack           = email.DateBack,
                    Description        = email.Description,
                    DeliverySystem     = email.DeliverySystem,
                    TrackingNumber     = email.TrackingNumber,
                    TrackingNumberBack = email.TrackingNumberBack,
                    Statuses           = _db.EmailStatuses.OrderByDescending(i => i.Id == email.StatusID).ThenBy(i => i).ToList()
                });
            }
            return(emailVMs);
        }