Ai
1 Star 3 Fork 0

梁灿林/MyWebApi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
IssueManager.cs 988 Bytes
一键复制 编辑 原始数据 按行查看 历史
梁灿林 提交于 2023-02-03 12:04 +08:00 . Abp 测试 内容
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
namespace My.Domain.Issues
{
public class IssueManager : DomainService
{
private readonly IRepository<Issue, Guid> _issueRepository;
public IssueManager(IRepository<Issue, Guid> issueRepository)
{
_issueRepository = issueRepository;
}
public async Task AssignToAsync(Issue issue, Guid userId)
{
//不允许用户有超过3个打开的问题
var openIssueCount = await _issueRepository.CountAsync(i => i.AssignedUserId == userId && !i.IsClosed);
if (openIssueCount >= 3)
{
throw new BusinessException(code: "123", message: "用户已经绑定超过3个已打开的问题");
}
issue.AssignedUserId = userId;
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lin913578307/my-web-api.git
git@gitee.com:lin913578307/my-web-api.git
lin913578307
my-web-api
MyWebApi
master

搜索帮助