Exemplo n.º 1
0
        public async Task <ApiResult> Insert(InsertProcessStep request, CancellationToken cancellationToken)
        {
            var item = request.Item ?? throw new ArgumentNullException(nameof(request.Item));

            item.Uid = Guid.NewGuid();

            int affected;

            using (var db = _dbContextFactory.Create())
            {
                affected = await db.GetTable <DbProcessStep>()
                           .Value(x => x.Uid, item.Uid)
                           .Value(x => x.ProcessUid, request.ProcessUid)
                           .Value(x => x.TypeCode, "ui")              // todo: ask user
                           .Value(x => x.Name, item.Name)
                           .Value(x => x.Description, item.Description)
                           .Value(x => x.DisplayOrder, item.DisplayOrder)
                           .InsertAsync(cancellationToken);
            }

            return(new ApiResult {
                Uid = item.Uid, AffectedRows = affected
            });
        }
Exemplo n.º 2
0
 public async Task <ApiResult> Insert(InsertProcessStep request)
 {
     return(await _mediator.Send(request));
 }