Example #1
0
        public async Task <IActionResult> Create([Bind("id,full_name")] Users users)
        {
            if (ModelState.IsValid)
            {
                await _usersService.AddAndSave(users);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("UserID,FirstName,LastName,Email")] User user)
        {
            if (ModelState.IsValid)
            {
                await _service.AddAndSave(user);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Example #3
0
        public async Task AddTest()
        {
            var fake        = Mock.Of <IUsersRepo>();
            var userService = new UsersService(fake);

            var user = new User()
            {
                Full_Name = "somebody"
            };
            await userService.AddAndSave(user);
        }