public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ObjectId")] qvCheckPoint qvCheckPoint) { if (id != qvCheckPoint.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(qvCheckPoint); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!qvCheckPointExists(qvCheckPoint.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["ObjectId"] = new SelectList((from s in _context.Objects select new { Id = s.Id, Name = s.Name }), "Id", "Name", qvCheckPoint.ObjectId); return(View(qvCheckPoint)); }
public async Task <IActionResult> Create([Bind("Id,Name,ObjectId")] qvCheckPoint qvCheckPoint) { if (ModelState.IsValid) { _context.Add(qvCheckPoint); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["ObjectId"] = new SelectList(_context.Objects, "Id", "Id", qvCheckPoint.ObjectId); return(View(qvCheckPoint)); }