public async Task <IActionResult> Create([Bind("Id,Name,Descrition")] Role role)
        {
            if (ModelState.IsValid)
            {
                _context.Add(role);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(role));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Surname,Mail,Password,KeyWord,ExpiredDate,IsTemporary,Image,Image2,Description,RoleId")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoleId"] = new SelectList(_context.Roles, "Id", "Name", user.RoleId);
            return(View(user));
        }