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, }); }
public static List <NeedsMatchViewModel> FromEntities(Need s, List <Supplier> suppliers) { List <SelectListItem> supplierSelectListItems = SelectListItem_FromEntity.FromEntities(suppliers); return(s.NeedPpeTypes.SelectToList(p => NeedsMatchViewModel.FromEntity(p, supplierSelectListItems))); }