public HttpResponseMessage Edit(ContentDetailModel model) { Regex reg = new Regex(@"^[^ %@#!*~&',;=?$\x22]+$"); var m = reg.IsMatch(model.Title); if (!m) { return(PageHelper.toJson(PageHelper.ReturnValue(false, "标题存在非法字符!"))); } else { var content = _contentService.GetContentById(model.Id); var newChannel = _channelService.GetChannelById(model.ChannelId); content.Title = model.Title; content.Content = model.Content; content.Status = model.Status; content.AdSubTitle = model.AdSubTitle; content.UpdUser = _workContent.CurrentUser.Id; content.UpdTime = DateTime.Now; content.Channel = newChannel; if (_contentService.Update(content) != null) { return(PageHelper.toJson(PageHelper.ReturnValue(true, "数据更新成功!"))); } else { return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据更新失败!"))); } } }
public JsonResult GetContent(ContentSearchCriteria criteria) { ContentDetailModel model = new ContentDetailModel(); try { var contentInfo = _contentService.GetContentInfo(criteria.ContentId); if (contentInfo != null) { model.ContentId = contentInfo.ContentId; model.ContentText = contentInfo.ContentText; } } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); model.ErrorCode = exception.ErrorCode; model.ErrorDescription = exception.Message; } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); model.ErrorCode = ErrorCode.InternalErrorException; model.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(model)); }
public IActionResult ContentDetails(ContentDetailModel contentModel) { try { if (ModelState.IsValid) { var contentDetailModel = iContent.GetContentDetail(contentModel.shortName); if (contentDetailModel != null) { AddContentModel addContentModel = ContentHelper.BindContentDetailsModel(contentDetailModel); return(Ok(ResponseHelper.Success(addContentModel))); } else { return(Ok(ResponseHelper.Error(MessageConstants.ContentNotFound))); } } else { return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }
public ActionResult Detail(long id) { try { var content = daoContent.getById(id); var model = new ContentDetailModel(); model.content = content; model.lstWouldYouLikeView = daoContent.WouldYouLikeView(content); return(View(model)); } catch { SetAlert("Có lỗi xả ra, hãy thử lại!", "error"); return(RedirectToAction("Index")); } }
private async void GetContentDetailsRequest() { try { model = await App.Client.GetContentDetail(id); if (model.status == "true") { webView.NavigateToString(model.feeds[0].post_content); } } catch (Exception) { } }
public IActionResult Detail(int id) { var content = contents.GetById(id); var model = new ContentDetailModel { Id = id, UploadDate = content.UploadDate, Type = content.Type, Location = content.Location, Description = content.Description, ImageUrl = content.ImageUrl, UserId = content.UserId }; return(View(model)); }
public IActionResult Detail(int id) { Data.Models.Content content = contents.GetById(id); ContentDetailModel model = new ContentDetailModel { Id = id, Description = content.Description, ImageUrl = content.ImageUrl, Location = content.Location, Tags = content.Tags, Type = content.Type, UploadDate = content.UploadDate, UserId = content.UserId }; return(View(model)); }
public HttpResponseMessage Detailed(int id) { var content = _contentService.GetContentById(id); if (content == null) { return(PageHelper.toJson(PageHelper.ReturnValue(false, "该数据不存在!"))); } var contentDetail = new ContentDetailModel { Id = content.Id, Title = content.Title, TitleImg = content.TitleImg, Content = content.Content, ChannelName = content.Channel.Name, ChannelId = content.Channel.Id, Status = content.Status, AdSubTitle = content.AdSubTitle }; return(PageHelper.toJson(contentDetail)); }
public HttpResponseMessage Create(ContentDetailModel model) { Regex reg = new Regex(@"^[^ %@#!*~&',;=?$\x22]+$"); var m = reg.IsMatch(model.Title); if (!m) { return(PageHelper.toJson(PageHelper.ReturnValue(false, "标题存在非法字符!"))); } else { var newChannel = _channelService.GetChannelById(model.ChannelId); if (newChannel == null) { return(PageHelper.toJson(PageHelper.ReturnValue(false, "请选择频道!"))); } var content = new ContentEntity { Title = model.Title, TitleImg = model.TitleImg, Content = model.Content, Status = model.Status, Channel = newChannel, Adduser = _workContent.CurrentUser.Id, Addtime = DateTime.Now, UpdUser = _workContent.CurrentUser.Id, UpdTime = DateTime.Now, AdSubTitle = model.AdSubTitle }; if (_contentService.Create(content) != null) { return(PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功!"))); } else { return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败!"))); } } }