public static IList <CustomFeedFieldViewModel> GetFeedFields(ICustomFeedService feedService, DSFileTypes dsFeedType, DSProductType dsProductType) { return(CustomFeedFieldViewModel.Build( feedService.GetSourceFieldsListForIncomingFeed(dsFeedType, dsProductType).Select(i => new CustomFeedFieldDTO() { SourceFieldName = i, }).ToList())); }
public CustomIncomingFeedViewModel(IUnitOfWork db, ICustomFeedService feedService, long?id) { if (id.HasValue) { var feed = db.CustomFeeds.Get(id.Value); Id = feed.Id; FeedName = feed.FeedName; DropShipperId = feed.DropShipperId; OverrideDSFeedType = feed.OverrideDSFeedType; OverrideDSProductType = feed.OverrideDSProductType; FtpSite = feed.FtpSite; FtpFolder = feed.FtpFolder; UserName = feed.UserName; IsPassiveMode = feed.IsPassiveMode; IsSFTP = feed.IsSFTP; Password = feed.Password; CreateDate = feed.CreateDate; if (DropShipperId.HasValue) { var dropShipper = db.DropShippers.GetAllAsDto() .FirstOrDefault(ds => ds.Id == feed.DropShipperId); DropShipperName = dropShipper?.Name; } var fields = db.CustomFeedFields.GetAllAsDto() .Where(f => f.CustomFeedId == id) .OrderBy(f => f.SortOrder) .ToList(); Fields = CustomFeedFieldViewModel.Build(fields); } else { Fields = GetFeedFields(feedService, (DSFileTypes)(OverrideDSFeedType ?? (int)DSFileTypes.ItemsFull), (DSProductType)(OverrideDSProductType ?? (int)DSProductType.Watches)); OverrideDSFeedType = (int)DSFileTypes.ItemsFull; OverrideDSProductType = (int)DSProductType.Watches; } }