예제 #1
0
        /// <summary>
        /// 更新地标点信息
        /// </summary>
        /// <param name="inputDtos"></param>
        /// <returns></returns>
        public async Task <OperationResult> Update(params MarkPointInfoInputDto[] inputDtos)
        {
            inputDtos.CheckNotNull("inputDtos");
            foreach (MarkPointInfoInputDto dtoData in inputDtos)
            {
                if (string.IsNullOrEmpty(dtoData.MarkPointNo))
                {
                    return(new OperationResult(OperationResultType.Error, "请正确填写地标点编号,该组数据不被存储。"));
                }
                if (string.IsNullOrEmpty(dtoData.MarkPointName))
                {
                    return(new OperationResult(OperationResultType.Error, "请正确填写地标点名称,该组数据不被存储。"));
                }
                if (MarkPointInfoRepository.CheckExists(x => x.MarkPointNo == dtoData.MarkPointNo && x.Id != dtoData.Id))
                {
                    return(new OperationResult(OperationResultType.Error, $"地标点编号 {dtoData.MarkPointNo} 的数据已存在,该组数据不被存储。"));
                }
                if (MarkPointInfoRepository.CheckExists(x => x.MarkPointName == dtoData.MarkPointName && x.Id != dtoData.Id))
                {
                    return(new OperationResult(OperationResultType.Error, $"地标点名称 {dtoData.MarkPointName} 的数据已存在,该组数据不被存储。"));
                }
            }
            MarkPointInfoRepository.UnitOfWork.BeginTransaction();
            var result = await MarkPointInfoRepository.UpdateAsync(inputDtos);

            MarkPointInfoRepository.UnitOfWork.Commit();
            return(result);
        }
예제 #2
0
 /// <summary>
 /// 检查实体是否存在
 /// </summary>
 /// <param name="predicate"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool CheckMarkPointInfoExists(Expression <Func <MarkPointInfo, bool> > predicate, Guid id)
 {
     return(MarkPointInfoRepository.CheckExists(predicate, id));
 }