public async Task <IActionResult> Create([Bind("PersonId,Name,Surname")] Person person) { if (ModelState.IsValid) { _context.Add(person); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(person)); }
public async Task <IActionResult> Create([Bind("BugId,Title,Description,IsClosed")] BugCreateViewModel model) { if (ModelState.IsValid) { _context.Add(model); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(model)); }
public async Task <IActionResult> Create([Bind("ProjectID,ProjectName,ManagerID")] Project project) { if (ModelState.IsValid) { _context.Add(project); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } List <BugTrackerUser> Managers = new List <BugTrackerUser>(); foreach (BugTrackerUser user in _context.BugTrackerUsers) { if (rolesManipulator.GetUserRoles(user.BugTrackerUserID).ID == RolesIDs.ManagerID) { Managers.Add(user); } } ViewData["ManagerID"] = new SelectList(Managers, "BugTrackerUserID", "Name"); return(View(project)); }
public void AddTicket(Ticket ticket) { db.Add(ticket); db.SaveChanges(); }