Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email")] IssueReporter issueReporter)
        {
            if (ModelState.IsValid)
            {
                _context.Add(issueReporter);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(issueReporter));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email")] Assignee assignee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(assignee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(assignee));
        }
        public async Task <IActionResult> Create([Bind("Id,AssigneeId,IssueReporterId,Content")] Issue issue)
        {
            if (ModelState.IsValid)
            {
                issue.ReportedDate = DateTime.Now;
                _context.Add(issue);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssigneeId"]      = new SelectList(_context.Assignee, "Id", "Email", issue.AssigneeId);
            ViewData["IssueReporterId"] = new SelectList(_context.Set <IssueReporter>(), "Id", "Email", issue.IssueReporterId);

            return(View(issue));
        }