Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Company")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Theme,PersonId,ContactName")] Report report)
        {
            if (ModelState.IsValid)
            {
                _context.Add(report);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"] = new SelectList(_context.People, "Id", "Id", report.PersonId);
            return(View(report));
        }