Пример #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("TransactionId,ExternalIBAN,ExternalName,Amount,Time,Details,Status")] Transaction transaction)
        {
            if (id != transaction.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(transaction);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TransactionExists(transaction.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(transaction));
        }
Пример #2
0
        public T Update(T itemToUpdate)
        {
            var entity = dbContext.Update <T>(itemToUpdate);

            dbContext.SaveChanges();
            return(entity.Entity);
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("RequestId,Type,SendDate")] Request request)
        {
            if (id != request.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(request);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RequestExists(request.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(request));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("ContactDetailId,Adress,City,Country,PhoneNo,AlternatePhoneNo,Email")] ContactDetails contactDetail)
        {
            if (id != contactDetail.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contactDetail);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContactDetailExists(contactDetail.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(contactDetail));
        }
Пример #5
0
        public async Task <IActionResult> Edit(Guid id, [Bind("LoanId,Value,StartDate,EndDate,LunarFee")] Loan loan)
        {
            if (id != loan.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(loan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoanExists(loan.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(loan));
        }