Пример #1
0
            public async Task <Unit> Handle(Command request, CancellationToken cancellationToken)
            {
                var successCounts = 0;

                foreach (var element in request.StateRegions)
                {
                    var stateRegion = new StateRegion
                    {
                        Id            = new Guid(),
                        State         = element.State,
                        Month         = element.Month,
                        NumberOfSales = element.NumberOfSales
                    };

                    _context.StateRegions.Add(stateRegion);
                    var success = await _context.SaveChangesAsync() > 0;

                    if (success)
                    {
                        successCounts++;
                    }
                }


                if (successCounts > 0)
                {
                    return(Unit.Value);
                }

                throw new Exception("Problem saving changes");
            }
Пример #2
0
    public StateRegion assign(Region reg)
    {
        StateRegion ret = new StateRegion(libtischPINVOKE.StateRegion_assign(swigCPtr, Region.getCPtr(reg)), false);

        if (libtischPINVOKE.SWIGPendingException.Pending)
        {
            throw libtischPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #3
0
 public StateRegion assign(Region reg) {
   StateRegion ret = new StateRegion(libtischPINVOKE.StateRegion_assign(swigCPtr, Region.getCPtr(reg)), false);
   if (libtischPINVOKE.SWIGPendingException.Pending) throw libtischPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Пример #4
0
 internal static HandleRef getCPtr(StateRegion obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Пример #5
0
 internal static HandleRef getCPtr(StateRegion obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }