public async Task UpdateActivity(UpdateActivityInput input) { if (!input.AllProjects && input.Projects.Count == 0) { throw new UserFriendlyException("不区分小区,所属小区至少选择一样!"); } var activity = await _activityRepository.GetAsync(input.Id); input.MapTo(activity); await _activityRepository.UpdateAsync(activity); _detailManager.Save(DetailType.Activity, activity.Id, input.Content); await _activityProjectRepository.DeleteAsync(t => t.ActivityId == activity.Id); if (!input.AllProjects) { foreach (var project in input.Projects) { await _activityProjectRepository.InsertAsync(new ActivityProject() { ActivityId = activity.Id, ProjectId = project }); } } }
/// <inheritdoc/> public async Task UpdateActivity(UpdateActivityInput input) { var activity = await _activityRepository.GetAsync(input.Id); input.MapTo(activity); await _activityRepository.UpdateAsync(activity); }