private void FillPicsUrlsIfAny(AdDetailsResponse adViewModel) { foreach (var media in adViewModel.AdMedia) { media.ScaledPics.ForEach(x => x.RelativePath = GetPartialPicUrl(x.PathParts)); } }
private void FillPicsJson(AdDetailsResponse adViewModel) { var jsonPicInfos = new List <AdPicInfoModelResponse>(); foreach (var media in adViewModel.AdMedia) { var previewPic = media.ScaledPics.FirstOrDefault(x => x.PicType == ViewImageType.Preview_M); if (previewPic == null) { continue; } var newPicInfo = new AdPicInfoModelResponse() { id = previewPic.ScaledPicId, isMain = media.IsPrimary, selected = media.IsPrimary, url = previewPic.RelativePath }; jsonPicInfos.Add(newPicInfo); } adViewModel.PicsJson = JsonConvert.SerializeObject(jsonPicInfos); }