public async Task <IActionResult> PutPaymentDetail([FromRoute] int id, [FromBody] PaymentDetail paymentDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != paymentDetail.paymentId) { return(BadRequest()); } _context.Entry(paymentDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentDetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPayment(string id, Payment payment) { if (id != payment.fPaymentId) { return(BadRequest()); } _context.Entry(payment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Edit(Payment payment, List <double> Claims, List <string> Texts, List <int> PositionId) { if (ModelState.IsValid) { payment.Positions = db.Positions.Where(p => p.PaymentId == payment.PaymentId && PositionId.Contains(p.PositionId)).ToList(); List <Position> del_pos = db.Positions.Where(p => p.PaymentId == payment.PaymentId && !PositionId.Contains(p.PositionId)).ToList(); foreach (var pos in del_pos) { db.Entry(pos).State = EntityState.Deleted; } db.Payments.Update(payment); double SSum = 0; for (int i = 0; i < Claims.Count(); i++) { if (i < payment.Positions.Count) { payment.Positions[i].Claim = Claims[i]; payment.Positions[i].Text = Texts[i]; } else { Position pos = new Position { PaymentId = payment.PaymentId, Claim = Claims[i], Text = Texts[i] }; payment.Positions.Add(pos); } SSum += Claims[i]; } payment.Sum = SSum; await db.SaveChangesAsync(); return(RedirectToAction("Withdraw", new { str = "Изменения были сохранены!" })); } else { return(View(payment)); } }
public async Task <Orders> GetOrder(string paymentId) { var order = await _paymentContext.Orders.SingleOrDefaultAsync(x => x.PaymentId == Guid.Parse(paymentId)); if (order != null) { await _paymentContext.Entry(order).Collection(x => x.OrderDetails).LoadAsync(); } return(order); }
public void Update(Payment item) { try { _context.Entry(item).State = EntityState.Modified; _context.SaveChanges(); } catch (Exception) { throw; } }
public ActionResult Edit(Forms edit) { if (!ModelState.IsValid) { var check_edit = (from m in pm.Form where m.Id == edit.Id select m).First(); return(View(check_edit)); } pm.Form.Attach(edit); pm.Entry(edit).State = EntityState.Modified; pm.SaveChanges(); return(RedirectToAction("ListF")); }
public void Confirm(Guid paymentId) { var payment = _paymentContext.Payments.FirstOrDefault(p => p.ID == paymentId); payment.State = UserPaymentState.Confirmed; _paymentContext.Payments.Attach(payment); var entry = _paymentContext.Entry(payment); //entry.State = EntityState.Modified; entry.Property(e => e.State).IsModified = true; _paymentContext.SaveChanges(); }
//Call this function when the user pays his pending invoices and reactives his subscription public void PayAllOverdues() { List <Payment> Payments; using (var db = new PaymentContext()) { Payments = db.Payment.Where(x => x.SubscriptionId.Equals(WebSecurity.CurrentUserId) && x.Status.Equals("overdue")).ToList(); foreach (var debt in Payments) { debt.Status = "cancelled"; db.Entry(debt).State = EntityState.Modified; } db.SaveChanges(); GenerateNextPayment(); ReactiveSubscription(WebSecurity.CurrentUserId); } }
public async Task <string> Post([FromBody] Paying paying) { var paymentItem = await _context.PaymentItems.FindAsync(paying.Id); if (paymentItem == null) { return("there is no payment id:" + paying.Id); } if (paying.opertion.Equals("pay")) { if (!paymentItem.State.Equals("unpaid")) { return("payment id " + paying.Id + " is not unpaid"); } paymentItem.State = "paid"; paymentItem.PayDate = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); _context.Entry(paymentItem).State = EntityState.Modified; await _context.SaveChangesAsync(); //发布一个信息,告诉Ticket去更新票的状态 TicketMessage ticketMessage = new TicketMessage { TicketId = paymentItem.TicketId, State = 1 }; await _bus.PublishAsync(ticketMessage); string mess = "payment id " + paying.Id + " is paid and ticket " + paymentItem.TicketId + " is sold now"; return(mess); } else if (paying.opertion.Equals("cancel")) { if (!paymentItem.State.Equals("unpaid")) { return("payment id " + paying.Id + " is not unpaid"); } paymentItem.State = "cancelled"; _context.Entry(paymentItem).State = EntityState.Modified; await _context.SaveChangesAsync(); //发布一个信息,告诉Ticket去更新票的状态 TicketMessage ticketMessage = new TicketMessage { TicketId = paymentItem.TicketId, State = 2 }; await _bus.PublishAsync(ticketMessage); string mess = "payment id " + paying.Id + " is cancelled and ticket " + paymentItem.TicketId + " is available now"; return(mess); } else if (paying.opertion.Equals("refund")) { if (!paymentItem.State.Equals("paid")) { return("payment id " + paying.Id + " is not paid"); } paymentItem.State = "refund"; _context.Entry(paymentItem).State = EntityState.Modified; await _context.SaveChangesAsync(); //发布一个信息,告诉Ticket去更新票的状态 TicketMessage ticketMessage = new TicketMessage { TicketId = paymentItem.TicketId, State = 2 }; await _bus.PublishAsync(ticketMessage); string mess = "payment id " + paying.Id + " is refund and ticket " + paymentItem.TicketId + " is available now"; return(mess); } else { string mess = "opertion should be pay, cancel or refund "; return(mess); } }
public void Insert(Payment data) { _context.Entry(data).State = EntityState.Added; }
public void Update(Domain.AggregatesModel.PaymentAggregate.Payment payment) { _context.Entry(payment).State = EntityState.Modified; }
public void Update(TEntity entity) { Db.Entry(entity).State = EntityState.Modified; }
public override void Add(Payment entity) { context.Entry(entity.Booking.User).State = EntityState.Unchanged; context.Entry(entity.Booking.Spot).State = EntityState.Unchanged; base.Add(entity); }
public void Update(T entity) { _dbContext.Entry(entity).State = EntityState.Modified; }
public void Update(Account account) { _context.Entry(account).State = EntityState.Modified; }
public void UpdatePayment(Payment item) { _context.Entry(item).State = EntityState.Modified; _context.SaveChanges(); }
public void Update(T entity) { _entity.Add(entity); _context.Entry(entity).State = EntityState.Modified; }
public void UpdatePayment(Payment payment) { _dbContext.Entry(payment).State = Microsoft.EntityFrameworkCore.EntityState.Modified; Save(); }
public virtual void Update(TEntity entityToUpdate) { _dbSet.Attach(entityToUpdate); _paymentContext.Entry(entityToUpdate).State = EntityState.Modified; }