internal static LocationVm FromModel(Location location) { return(new LocationVm { Id = location.Id, Address = ContactInformationVm.FromModel(location.Address), Hours = location.HoursOfOperation, DistanceFromPoint = location.DistanceFromPoint }); }
internal static OrganizationVm FromModel(Organization organization) { if (organization.Admin == null) { organization.Admin = new Admin(); } List <NeededSubCategoryVm> subCategoriesForModel = new List <NeededSubCategoryVm>(); if (organization.NeededSubCategories != null) { foreach (var type in organization.NeededSubCategories) { subCategoriesForModel.Add(NeededSubCategoryVm.FromModel(type)); } } List <LocationVm> locationsForModel = new List <LocationVm>(); if (organization.Locations != null) { foreach (var type in organization.Locations) { locationsForModel.Add(LocationVm.FromModel(type)); } } return(new OrganizationVm { Id = organization.Id, Admin = AdminVm.FromModel(organization.Admin), ContactInformation = ContactInformationVm.FromModel(organization.HeadquartersContactInformation), EIN = organization.EIN, Name = organization.Name, NeededSubCategories = subCategoriesForModel, Subscription = organization.Subscription, Locations = locationsForModel, Budget = organization.Budget, DonationDescription = organization.DonationDescription, MissionStatement = organization.MissionStatement, Pickup = organization.Pickup, PathToLogo = organization.PathToLogo }); }