Пример #1
0
        public async Task <IActionResult> Create([Bind("Name,Id")] Skill skill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(skill);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(skill));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("FirstName,LastName,OrganizationId,Id")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["OrganizationId"] = new SelectList(_context.Set <Organization>(), "Id", "Name", person.OrganizationId);
            return(View(person));
        }