Пример #1
0
 public async Task <IHttpActionResult> Put([FromBody] FileCollectionRequestModel value)
 {
     try
     {
         _uow.File.UpdateCollection(value, this.CurrentUserId);
         return(Ok());
     }
     catch (BusinessException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (Exception ex)
     {
         _log.Error(ex);
         return(BadRequest(this.General_Err));
     }
 }
Пример #2
0
 public void UpdateCollection(FileCollectionRequestModel files, string userId)
 {
     foreach (var item in files.Ids)
     {
         var f = _dbSet.SingleOrDefault(x => x.Id == item);
         if (f != null)
         {
             if (IsOwnerOrAdmin(f.UserId, userId) == false)
             {
                 return;
             }
             f.CollectionId = files.CollectionId;
             //this.RemoveCache(item);
         }
     }
     this.Commit();
 }
Пример #3
0
 public void UpdateCate(FileCollectionRequestModel files)
 {
     foreach (var item in files.Ids)
     {
         var f = _dbSet.SingleOrDefault(x => x.Id == item);
         if (f != null)
         {
             if (f.CateId.HasValue)
             {
                 this.RemoveCache(f.CateId.Value);
             }
             f.CateId = files.CollectionId;
         }
     }
     //if (files.CollectionId.HasValue) this.RemoveCache(files.CollectionId.Value);
     this.Commit();
 }