public OperationResult Create(Dish dish)
 {
     try
     {
         _dao.Create(dish);
         return(new OperationResult()
         {
             Success = true
         });
     }
     catch (Exception e)
     {
         return(new OperationResult()
         {
             Success = false, Exception = e
         });
     }
 }
Esempio n. 2
0
 public virtual OperationResult Create(Dish dish)
 {
     try
     {
         using var transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions, TransactionScopeAsyncFlowOption.Enabled);
         _dao.Create(dish);
         transactionScope.Complete();
         return(new OperationResult <List <Dish> > {
             Success = true
         });
     }
     catch (Exception e)
     {
         return(new OperationResult <List <Dish> >()
         {
             Success = false, Exception = e
         });
     }
 }