Example #1
0
            public async Task <HearFromDetails> Handle(Command request, CancellationToken cancellationToken)
            {
                using (var scope = _databaseScopeFactory.CreateReadOnly())
                {
                    var hearfrom = await _hearFromRepository.FindAsync <HearFromDetails>(request.Id.Value);

                    return(hearfrom);
                }
            }
Example #2
0
 private void Validate(Delete.Command message, CustomContext context)
 {
     using (var scope = _databaseScopeFactory.CreateReadOnly())
     {
         var model = _hearFromRepository.FindAsync <HearFromDetails>(message.Id.Value).GetAwaiter().GetResult();
         if (model == null)
         {
             context.AddNotFoundError("数据不存在");
         }
     }
 }
Example #3
0
 private void Validate(Update.Command message, CustomContext context)
 {
     using (var scope = _databaseScopeFactory.CreateReadOnly())
     {
         var model = _hearFromRepository.FindAsync(message.Id).GetAwaiter().GetResult();
         if (model == null)
         {
             context.AddNotFoundError("数据不存在");
         }
         else
         {
             if (message.Name.Equals(model.Name))
             {
                 context.AddNoContentError("数据未更改");
             }
         }
     }
 }