private void PostImages(AdvExportInfo exportInfo) { var images = exportInfo.Adv.AdvImages.Where(i => i.NeedUpload()).ToList(); foreach (var image in images) { var imagePath = image.GetImagePath(); var uploadData = UploadImage(imagePath); image.SetUploadData(uploadData); Context.Save(); } }
private void PostAdv(AdvExportInfo exportInfo) { if (exportInfo.IsNoAction() || exportInfo.IsRepostOnly()) return; bool postImages = exportInfo.Create || exportInfo.UpdateImages; if (postImages) PostImages(exportInfo); var adv = exportInfo.Adv; string formBody = CreateRequestBody(adv, exportInfo.Create); if (exportInfo.Create) { var lotNumber = PostCreateLot(formBody); adv.Number = Convert.ToInt32(lotNumber); adv.Published = true; adv.UpdateDateExpire(); } else { PostEditLot(formBody); adv.UpdateDateExpire(); } Context.Save(); }