public static EditNeedsViewModel FromPostData(EditNeedsPost s, List <Supplier> suppliers)
        {
            List <SelectListItem> ppeStatuses             = HtmlEnumExtensions.ToSelectListItems <PpeStatus>();
            List <SelectListItem> supplierSelectListItems = SelectListItem_FromEntity.FromEntities(suppliers);

            return(new EditNeedsViewModel {
                Request = s.Request,
                Status = new PostStatusViewModel {
                    Status = s.Status.Status,
                    PostStatuses = HtmlEnumExtensions.ToSelectListItems <PostStatus>()
                },
                Twitter = s.Twitter,
                NeedsMatching = s.NeedsMatching.ConvertAll(ppe => new NeedsMatchViewModel {
                    PpeType = ppe.PpeType,
                    Status = ppe.Status,
                    SupplierId = ppe.SupplierId,
                    SupplierOther = ppe.SupplierOther,
                    DateClosed = ppe.DateClosed,
                    //
                    Statuses = ppeStatuses,
                    Suppliers = supplierSelectListItems,
                }),
                Notes = new NotesViewModel {
                    NewNote = s.Notes.NewNote
                },
                Location = s.Location,
            });
        }
Esempio n. 2
0
 public static PostStatusViewModel FromEntity(IPostStatus s)
 {
     return(new PostStatusViewModel
     {
         Status = (PostStatus)s.StatusId,
         UshahidiId = s.UshahidiId,
         PostStatuses = HtmlEnumExtensions.ToSelectListItems <PostStatus>()
     });
 }
 public static NeedsMatchViewModel FromEntity(NeedPpeType s, List <SelectListItem> suppliers)
 {
     return(new NeedsMatchViewModel
     {
         PpeType = (PpeTypes)s.PpeTypeId,
         Status = (PpeStatus)s.StatusId,
         SupplierId = s.SupplierId,
         SupplierOther = s.SupplierOther,
         DateClosed = s.DateClosed,
         Statuses = HtmlEnumExtensions.ToSelectListItems <PpeStatus>(),
         Suppliers = suppliers,
     });
 }
Esempio n. 4
0
 public static EditSuppliesViewModel FromPostData(EditSuppliesPost s)
 {
     return(new EditSuppliesViewModel
     {
         Supplies = s.Supplies,
         Status = new PostStatusViewModel
         {
             Status = s.Status.Status,
             PostStatuses = HtmlEnumExtensions.ToSelectListItems <PostStatus>()
         },
         Location = s.Location,
         Notes = new NotesViewModel()
         {
             NewNote = s.Notes.NewNote
         }
     });
 }