public async Task <ActionResult <Guid> > Create(CrmTask task, CancellationToken ct = default) { task.AccountId = _userContext.AccountId; var id = await _tasksService.CreateAsync(_userContext.UserId, task, ct); return(Created("Get", id)); }
public async Task <ActionResult> Update(CrmTask task, CancellationToken ct = default) { var oldTask = await _tasksService.GetAsync(task.Id, true, ct); if (oldTask == null) { return(NotFound(task.Id)); } return(await ActionIfAllowed( () => _tasksService.UpdateAsync(_userContext.UserId, oldTask, task, ct), Roles.Tasks, oldTask.AccountId)); }