public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,InfoURL")] Company company) { if (id != company.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(company); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyExists(company.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(company)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ProjectName,Description")] Project project) { if (id != project.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(project); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectExists(project.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(project)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyId,ProjectId,ProjectManagerId,ExpenseDescription,SpentAmount")] Expense expense) { if (id != expense.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(expense); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExpenseExists(expense.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Company, "Id", "Id", expense.CompanyId); ViewData["ProjectId"] = new SelectList(_context.Set <Project>(), "Id", "Id", expense.ProjectId); ViewData["ProjectManagerId"] = new SelectList(_context.Set <ProjectManager>(), "Id", "Id", expense.ProjectManagerId); return(View(expense)); }