コード例 #1
0
 public IHttpActionResult Cancelreservation(int transid, DateTime cancel_date)
 {
     try
     {
         var trans = db.Transactions.Where(x => x.transaction_id == transid).FirstOrDefault();
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         if (trans != null)
         {
             trans.cancellation_status = true;
             db.Entry(trans).State     = EntityState.Modified;
             var pass = from p in db.passengers
                        where p.transaction_id == transid
                        select p;
             foreach (var p in pass)
             {
                 db.passengers.Remove(p);
             }
             cancellation can = new cancellation();
             can.transaction_id      = transid;
             can.cancellation_date   = cancel_date;
             can.cancellation_amount = trans.amount / 4;
             db.cancellations.Add(can);
             try
             {
                 db.SaveChanges();
             }
             catch (DbUpdateException)
             {
                 return(NotFound());
             }
             return(Ok(can));
         }
         else
         {
             return(BadRequest("Transaction Id does not exist"));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
コード例 #2
0
 => (accessQueue ?? throw new ArgumentNullException(nameof(accessQueue))).AccessAsync(accesses,
                                                                                      priority,
                                                                                      cancellation,
                                                                                      attemptsCount,
                                                                                      enqueueAll);
コード例 #3
0
 ?.EnqueueAsyncWork(work, priority, cancellation, attemptsCount)
 ?? provider.RequiredService <IWorkQueue>().EnqueueAsyncWork(work, cancellation, attemptsCount);
コード例 #4
0
 ?.EnqueueAsyncAccess(access, priority, cancellation, attemptsCount)
 ?? provider.RequiredService <IAccessQueue <TResource> >().EnqueueAsyncAccess(access, cancellation, attemptsCount);
コード例 #5
0
 => (conveyor ?? throw new ArgumentNullException(nameof(conveyor))).ProcessDataAsync(data, priority, cancellation, attemptsCount, enqueueAll);
コード例 #6
0
 ?.ProcessDataAsync(data, priority, cancellation, attemptsCount)
 ?? provider.RequiredService <IConveyor <TData, TResult> >().ProcessDataAsync(data, cancellation, attemptsCount);
コード例 #7
0
 => (queue ?? throw new ArgumentNullException(nameof(queue))).DoWorkAsync(works, priority, cancellation, attemptsCount, enqueueAll);