public IActionResult Update(GetAdDetailDto dto) { var getAdResult = _adService.GetAdDetail(dto); if (getAdResult.Code > 0) { return(Json(getAdResult)); } var model = new UpdateModel() { Ad = getAdResult.Data }; return(View("~/Administration/Views/Ad/Update.cshtml", model)); }
/// <summary> /// 获取详细 /// </summary> /// <param name="dto"></param> /// <returns></returns> public PublicResult <GetAdDetailInfo> GetAdDetail(GetAdDetailDto dto) { using (var client = DbFactory.CreateClient()) { var ad = client.Queryable <Ad>().InSingle(dto.Id); if (ad == null) { return(Error("找不到此信息")); } var resp = new GetAdDetailInfo { Id = ad.Id, AdPlaceId = ad.AdPlaceId, Title = ad.Title, ImagePath = ad.ImagePath, TargetUrl = ad.TargetUrl, Order = ad.OrderIndex, IsShow = ad.IsShow }; return(resp); } }