public ActionResult Edit([Bind(Include = "Id,MerchantName")] Merchant merchant)
 {
     if (ModelState.IsValid)
     {
         db.Entry(merchant).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(merchant));
 }
Example #2
0
        public ActionResult PutBank(int id, Bank bank)
        {
            if (id != bank.Id)
            {
                return(BadRequest());
            }

            _context.Entry(bank).State = EntityState.Modified;
            _context.SaveChanges();

            return(CreatedAtAction("GetBank", new Bank {
                Id = bank.Id
            }, bank));
        }
Example #3
0
        public async Task <Payment> Update(Payment payment)
        {
            var oldPayment = await _context.Payments
                             .Include(p => p.PaymentStatuses)
                             .Where(p => p.PaymentId == payment.PaymentId)
                             .FirstOrDefaultAsync();

            if (oldPayment != null)
            {
                _context.Entry(oldPayment).CurrentValues.SetValues(payment);
                await _context.SaveChangesAsync();
            }

            return(payment);
        }
 public void Update(TEntity obj)
 {
     _dbContext.Entry(obj).State = EntityState.Modified;
     _dbContext.SaveChanges();
 }