public async Task <ActionResult <RequestDto> > CreateRequestSandBox([FromBody] RequestDto request, CancellationToken cancellationToken) { request.TrackingNumber = _hasher.CalculateTimeHash("TrackingNumber" + Guid.NewGuid()); request.DateCreated = DateTime.Now; var res = await ModelService.CreateByDtoAsync(request, cancellationToken); await _signaler.Signal(_userAccountService.GetAll(u => u.AgentUserAccount.Any(a => a.IsResponsible)) .Select(u => u.Id).ToList(), nameof(Request), "A new request has arrived"); return(res); }
private async Task CreateNewActions() { var toCreate = _events.Where(i => i.Type == UserEventType.Todo).ToList(); if (toCreate.Count == 0) { return; } await _context.RequestAction.AddRangeAsync( toCreate.Select(e => new RequestAction { ActionDate = DateTime.Now, ActionTypeId = e.ActionTypeId, AgentId = e.AgentId, Description = e.Description, MetaDataJson = "{}", RequestId = e.RequestId, ActionTime = "", RequestActionFollowUpReference = e.Id, ActionIsSuccess = false, } ).ToList() ); await _context.SaveChangesAsync(); await _signaler.Signal(toCreate.Select(i => i.UserId).Distinct().ToList() , nameof(RequestAction), "New Action created for you"); }