public async Task <IActionResult> Edit(int id, [Bind("IdModelLamp,Name,Comment")] ModelLamp modelLamp) { if (id != modelLamp.IdModelLamp) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(modelLamp); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModelLampExists(modelLamp.IdModelLamp)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(modelLamp)); }
public async Task <IActionResult> Create([Bind("IdModelLamp,Name,Comment")] ModelLamp modelLamp) { if (ModelState.IsValid) { _context.Add(modelLamp); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(modelLamp)); }