public async Task <ProjectEntity> AddAsync(ProjectEntity project) { if (project.IsTransient()) { return((await _projectContext.AddAsync(project)).Entity); } return(project); }
public async Task <IActionResult> CreateProject([FromBody] ProjectEntity request) { //Todo: 参数正确性判断 if (request == null) { throw new ArgumentNullException("参数为空"); } request.UserId = UserIdentity.UserId; var command = new CreateProjectCommand { Project = request }; var project = await _mediator.Send(command); return(Ok(project)); }
public void Update(ProjectEntity project) { _projectContext.Update(project); }