public async Task <IActionResult> PutLogbooks([FromRoute] int id, [FromBody] Logbooks Logbooks) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != Logbooks.Id) { return(BadRequest()); } _context.Entry(Logbooks).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LogbooksExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Edit(int id, [Bind("Id,AspNetUserId,Moment,Eventdescription")] Logbooks Logbooks) { if (id != Logbooks.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(Logbooks); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LogbooksExists(Logbooks.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AspNetUserId"] = new SelectList(_context.AspNetUsers, "Id", "Id", Logbooks.AspNetUserId); return(View(Logbooks)); }
public async Task <IActionResult> PostLogbooks([FromBody] Logbooks Logbooks) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Logbooks.Add(Logbooks); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLogbooks", new { id = Logbooks.Id }, Logbooks)); }
public async Task <IActionResult> CreateLogTask([Bind("Id,AspNetUserId,Moment,Eventdescription")] Logbooks Logbooks) { if (ModelState.IsValid) { _context.Add(Logbooks); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AspNetUserId"] = new SelectList(_context.AspNetUsers, "Id", "Id", Logbooks.AspNetUserId); return(View(Logbooks)); }