Ejemplo n.º 1
0
        public IQueryable <Data.FootPrintImg> UpdateFootPrintRotatedImage(long imgId, string imageKey)
        {
            ExceptionHelper.ThrowIfNotId(imgId, nameof(imgId));
            ExceptionHelper.ThrowIfNullOrWhiteSpace(imageKey, nameof(imageKey));
            var img = Imgs.FirstOrDefault(p => p.id == imgId);

            ExceptionHelper.ThrowIfTrue(img == null, nameof(img), "该图片不存在");
            ExceptionHelper.ThrowIfTrue(img.isEnabled != true, nameof(img), "该图片审核不通过,不可进行旋转后保存操作");
            img.imageKey = imageKey;
            _FootPrintImgRepository.SaveChanges();
            return(Imgs);
        }
Ejemplo n.º 2
0
 public IQueryable <Data.FootPrintImg> SetFootPrintImageIsEnabled(long operatorId, long imgId, bool isEnabled)
 {
     ExceptionHelper.ThrowIfNotId(imgId, nameof(imgId));
     using (var scope = new TransactionScope())
     {
         var img = Imgs.FirstOrDefault(p => p.id == imgId);
         ExceptionHelper.ThrowIfTrue(img == null, nameof(img), "该图片不存在");
         img.isEnabled   = isEnabled;
         img.isComfirm   = true;
         img.comfirmDate = DateTime.Now;
         img.comfirmer   = operatorId;
         _FootPrintImgRepository.SaveChanges();
         scope.Complete();
         return(Imgs);
     }
 }
Ejemplo n.º 3
0
 public IQueryable <Data.FootPrintImg> SetFootPrintImgOrder(long imgId, int order)
 {
     ExceptionHelper.ThrowIfNotId(imgId, nameof(imgId));
     ExceptionHelper.ThrowIfTrue(order <= 0, nameof(order));
     using (var scope = new TransactionScope())
     {
         var oldCover = Imgs.FirstOrDefault(p => p.order == order);
         if (oldCover != null)
         {
             oldCover.order = null;
         }
         var img = Imgs.FirstOrDefault(p => p.id == imgId);
         ExceptionHelper.ThrowIfTrue(img == null, nameof(img), "该图片不存在");
         ExceptionHelper.ThrowIfTrue(img.isEnabled != true, nameof(img), "该图片审核不通过,不可设置为封面");
         img.order = order;
         _FootPrintImgRepository.SaveChanges();
         scope.Complete();
         return(Imgs);
     }
 }