public async Task CreateAsync(Guid id, User user, string name) { var label = await _labelRepository.GetAsync(id, user.Id); if (label != null) { throw new ServiceException(ErrorCodes.LabelAlreadyExist); } label = new Label(id, user, name); await _labelRepository.AddAsync(label); }
public async Task UpdateLabelAsync(Guid taskId, Guid labelId) { var task = await _taskRepository.GetAsync(taskId); if (task == null) { throw new ServiceException(ErrorCodes.TaskNotExist); } var label = await _labelRepository.GetAsync(labelId, task.UserId); task.SetLabel(label); await _taskRepository.UpdateAsync(task); }