コード例 #1
0
        public IActionResult GetById([FromForm(Name = ("Id"))] int Id)
        {
            var result = _productImageService.GetById(Id);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
コード例 #2
0
        // GET: admin/product/Products/Delete/5
        public IActionResult DeleteImage(int id)
        {
            var image = productImageService.GetById(id);

            if (image == null)
            {
                return(NotFound());
            }
            return(View(image));
        }
コード例 #3
0
 /// <summary>
 /// 编辑
 /// </summary>
 /// <param name="vm"></param>
 /// <returns></returns>
 public ActionResult Edit(ProductImageVM vm)
 {
     vm.ProductImage = _ProductImageService.GetById(vm.Id) ?? new ProductImage();
     vm.ImgInfo      = vm.ProductImage.BaseImage ?? new BaseImage();
     if (vm.ProductImage.ProductId == 0)
     {
         vm.ProductImage.ProductId = vm.ProductId;
     }
     return(View(vm));
 }
コード例 #4
0
        public IActionResult GetById([FromForm(Name = ("Id"))] int id)
        {
            Thread.Sleep(1000);
            var result = _productImageService.GetById(id);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
コード例 #5
0
        public async Task <IActionResult> Delete(int id)
        {
            var hasPermission = await _authorizationService.AuthorizeAsync(User, "PRODUCT", Operations.Delete);

            if (hasPermission.Succeeded == false)
            {
                return(new BadRequestObjectResult(CommonConstants.Forbidden));
            }
            ProductImageViewModel productImageVm = _productImageService.GetById(id);

            _productImageService.Delete(id);
            _productImageService.SaveChanges();
            productImageVm.Path.DeletementByString(_env);
            return(new OkObjectResult(id));
        }