Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Title,Description")] Roles roles)
        {
            if (ModelState.IsValid)
            {
                _db.Add(roles);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(roles));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,FullName,Email,Password,RolesId")] Admins admins)
        {
            if (ModelState.IsValid)
            {
                _db.Add(admins);
                await _db.SaveChangesAsync();

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

            ViewData["RolesId"] = new SelectList(_db.Roles, "Id", "Title", admins.RolesId);

            return(View(admins));
        }