예제 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,Price,MembersID")] Purchases purchases)
        {
            if (id != purchases.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(purchases);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PurchasesExists(purchases.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MembersID"] = new SelectList(_context.Membership, "ID", "email", purchases.MembersID);
            return(View(purchases));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,name,email")] Members members)
        {
            if (id != members.ID)
            {
                return(NotFound());
            }

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