public async Task <IActionResult> Create([Bind("ID,name,email")] Members members)
        {
            if (ModelState.IsValid)
            {
                _context.Add(members);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(members));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("ID,Price,MembersID")] Purchases purchases)
        {
            if (ModelState.IsValid)
            {
                _context.Add(purchases);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MembersID"] = new SelectList(_context.Membership, "ID", "email", purchases.MembersID);
            return(View(purchases));
        }