public JObject Init(string viewType) { SiocArticle Article = new SiocArticle() { //Id = Guid.NewGuid().ToString(), Specificulture = _lang }; switch (viewType) { case "be": var be = new RepositoryResponse <ApiArticleViewModel>() { IsSucceed = true, Data = new ApiArticleViewModel(Article) { Status = SWStatus.Preview } }; return(JObject.FromObject(be)); default: var fe = new RepositoryResponse <ApiArticleViewModel>() { IsSucceed = true, Data = new ApiArticleViewModel(Article) { Status = SWStatus.Preview } }; return(JObject.FromObject(fe)); } }
public async Task <JObject> BEDetails(string viewType, string id) { switch (viewType) { case "be": if (!string.IsNullOrEmpty(id)) { var beResult = await ApiArticleViewModel.Repository.GetSingleModelAsync(model => model.Id == id && model.Specificulture == _lang).ConfigureAwait(false); if (beResult.IsSucceed) { beResult.Data.DetailsUrl = SwCmsHelper.GetRouterUrl("Article", new { beResult.Data.SeoName }, Request, Url); } return(JObject.FromObject(beResult)); } else { var model = new SiocArticle() { Specificulture = _lang, Status = (int)SWStatus.Preview, Priority = ApiArticleViewModel.Repository.Max(a => a.Priority).Data + 1 }; RepositoryResponse <ApiArticleViewModel> result = new RepositoryResponse <ApiArticleViewModel>() { IsSucceed = true, Data = new ApiArticleViewModel(model) }; return(JObject.FromObject(result)); } default: if (!string.IsNullOrEmpty(id)) { var beResult = await ApiArticleViewModel.Repository.GetSingleModelAsync(model => model.Id == id && model.Specificulture == _lang).ConfigureAwait(false); if (beResult.IsSucceed) { beResult.Data.DetailsUrl = SwCmsHelper.GetRouterUrl("Article", new { beResult.Data.SeoName }, Request, Url); } return(JObject.FromObject(beResult)); } else { var model = new SiocArticle(); RepositoryResponse <ApiArticleViewModel> result = new RepositoryResponse <ApiArticleViewModel>() { IsSucceed = true, Data = new ApiArticleViewModel(model) { Specificulture = _lang, Status = SWStatus.Preview } }; return(JObject.FromObject(result)); } } }
public RepositoryResponse <ApiArticleViewModel> Create() { SiocArticle Article = new SiocArticle() { //Id = Guid.NewGuid().ToString(), Specificulture = _lang }; return(new RepositoryResponse <ApiArticleViewModel>() { IsSucceed = true, Data = new ApiArticleViewModel(Article) { Status = SWStatus.Preview } }); }
public RepositoryResponse <BEArticleViewModel> Create() { SiocArticle article = new SiocArticle() { //Id = Guid.NewGuid().ToString(), Specificulture = _lang }; return(new RepositoryResponse <BEArticleViewModel>() { IsSucceed = true, Data = new BEArticleViewModel(article) { Domain = this._domain } }); }