Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,CycleStart")] Group @group)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@group);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(@group));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,GroupId")] Member member)
        {
            if (ModelState.IsValid)
            {
                _context.Add(member);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GroupId"] = new SelectList(_context.Groups, "Id", "Name", member.GroupId);
            return(View(member));
        }