protected virtual async Task CreateAappraisalFileTypeAsync(CreateOrUpdateAappraisalFileTypeInput input) { try { if (_aappraisalFileTypeRepository.GetAll().Any(x => x.Name == input.Name && x.AppraisalTypeId == input.AppraisalTypeId)) { throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "同一评审类型名称不能相同。"); } var aappraisalFileType = new AappraisalFileType() { Name = input.Name, AppraisalTypeId = input.AppraisalTypeId, IsPaperFile = input.IsPaperFile, IsMust = input.IsMust, Sort = input.Sort, AuditRoleIds = input.AuditRoleIds, }; await _aappraisalFileTypeRepository.InsertAndGetIdAsync(aappraisalFileType); await CurrentUnitOfWork.SaveChangesAsync(); } catch (Exception ex) { throw; } }
protected virtual async Task <int> CreateAappraisalFileType(CreateOrUpdateAappraisalFileTypeInput input) { var aappraisalFileType = new AappraisalFileType() { Name = input.Name, AppraisalTypeId = input.AppraisalTypeId, IsMust = input.IsMust, IsPaperFile = input.IsPaperFile, AuditRoleIds = input.AuditRoleIds // Sort_id = input.Sort_id }; var retid = await _aappraisalFileTypeRepository.InsertAndGetIdAsync(aappraisalFileType); await CurrentUnitOfWork.SaveChangesAsync(); //It's done to get Id of the edition. return(retid); }