public bool WP_IsExist(Entities.RequestModel.PublishWpRequestModel obj) { var res = new WordpressUtils(obj.Domain, obj.PathUrl, obj.Token).IsExits(); if (res.Code == System.Net.HttpStatusCode.OK) { return((bool)res.Data); } else { throw new BusinessException(res.Message); } }
public async Task <string> IUPage(Entities.RequestModel.PublishWpRequestModel model, string userId) { var page = await uow.LandingPage.GetById(model.PageId); if (page == null) { throw new BusinessException("Lỗi! Không tim thấy landing page"); } if (string.IsNullOrEmpty(model.PathUrl) || string.IsNullOrEmpty(model.Token)) { throw new BusinessException("Lỗi! Vui lòng nhập Sub Url và Token"); } model.PathUrl = Utils.CommonUtils.ToFriendllyUrl(model.PathUrl); if (Exist(model.Domain, model.PathUrl)) { return(await UpdatePage(new ExternalPublish() { Token = model.Token, Domain = model.Domain, PathUrl = model.PathUrl, LandingPageId = model.PageId, UserId = userId }, page.Name, model.Html)); } else { return(await CreatePage(new ExternalPublish() { Token = model.Token, Domain = model.Domain, PathUrl = model.PathUrl, LandingPageId = model.PageId, UserId = userId }, page.Name, model.Html)); } }