Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Date")] Assignment assignment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(assignment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(assignment));
        }
        public async Task <IActionResult> Create([Bind("Date,Description,Value,AssignmentId")] Expense expense)
        {
            if (ModelState.IsValid)
            {
                _context.Add(expense);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index), new { expense.AssignmentId }));
            }
            ViewData["AssignmentId"] = expense.AssignmentId;
            return(View(expense));
        }