예제 #1
0
 /// <summary>
 /// 添加信息
 /// </summary>
 /// <param name="inputDtos">要添加的信息DTO信息</param>
 /// <returns>业务操作结果</returns>
 public OperationResult AddCollects(params CollectInputDto[] inputDtos)
 {
     return(CollectRepository.Insert(inputDtos,
                                     dto =>
     {
     },
                                     (dto, entity) =>
     {
         if (dto.UserId.HasValue && dto.UserId > 0)
         {
             User user = UserRepository.GetByKey(dto.UserId.Value);
             if (user == null)
             {
                 throw new Exception("未找到用户");
             }
             entity.User = user;
         }
         return entity;
     }));
 }
예제 #2
0
 /// <summary>
 /// 删除信息
 /// </summary>
 /// <param name="ids">要删除的信息编号</param>
 /// <returns>业务操作结果</returns>
 public OperationResult DeleteCollects(params int[] ids)
 {
     return(CollectRepository.Delete(ids));
 }
예제 #3
0
 /// <summary>
 /// 检查信息是否存在
 /// </summary>
 /// <param name="predicate">检查谓语表达式</param>
 /// <param name="id">更新的信息编号</param>
 /// <returns>信息是否存在</returns>
 public bool CollectCardExists(Expression <Func <Collect, bool> > predicate, int id = 0)
 {
     return(CollectRepository.CheckExists(predicate, id));
 }