public ActionResult <ProductImage> GetProductImage(int id) { var productImage = productImageService.GetProductImageById(id); if (productImage == null) { return(NotFound()); } return(productImage); }
public async Task <IActionResult> Create([FromForm] ProductImageCreateViewModel viewModel) { var result = await _productImage.CreateProducutImage(viewModel); if (result == 0) { return(BadRequest()); } var productImage = await _productImage.GetProductImageById(result); return(new OkObjectResult(productImage)); }
/// <summary> /// 加载数据 /// </summary> /// <param name="id">对象系统Id</param> /// <returns></returns> public ActionResult Create(long?id) { ProductImageModel model = null; if (id.HasValue) { var result = _productImageService.GetProductImageById(id.Value); if (result.Data != null) { model = result.Data; model.linkUrl = !string.IsNullOrEmpty(model.linkUrl) ? model.linkUrl : "http://"; ViewBag.ImgUrl = model.ImageUrl; ViewBag.ShowImgUrl = imagePath + model.ImageUrl; } } else { model = new ProductImageModel(); } DrowList(model); return(PartialView(model)); }
public ActionResult GetProductImage(int id) { var productImage = _productImageService.GetProductImageById(id); return(File(productImage.ImageData, "image/png")); }
public void DeleteProductPicture(int id) { var productPic = productImageService.GetProductImageById(id); productImageService.DeleteProductImage(productPic); }
public ActionResult <ProductImage> Get(int id) { return(_productImageService.GetProductImageById(id)); }