private void SetImagePathForSubscription(ref List <Subscriptions> entities) { entities.ForEach(item => { string imageUrl = Constant.ImageDefault; var image = SubscriptionImagesList.FirstOrDefault(x => x.SubscriptionId == item.Id && x.IsCover && x.IsActive); if (image != null) { imageUrl = image.Url; } try { item.AdminImageUrl = imageUrl; item.ImageUrl = string.Format("{0}", new Uri(new Uri(AppConfiguration.CdnImageUrlDefault), imageUrl).AbsoluteUri); } catch (Exception) { item.ImageUrl = imageUrl; } }); }
public SubscriptionImages GetImageById(long id) { return(SubscriptionImagesList.FirstOrDefault(h => h.Id == id)); }