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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
        public async Task <IActionResult> Create(UserFormViewModel obj)
        {
            User user = new User();

            user.Name     = obj.Name;
            user.Login    = obj.Login;
            user.Password = obj.Password;
            user.OwnerId  = obj.OwnerId;
            user.Admin    = obj.Admin;


            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }