public async Task <IActionResult> PutTasks([FromRoute] int id, [FromBody] Tasks tasks) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tasks.Id) { return(BadRequest()); } _context.Entry(tasks).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TasksExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,Title,Description")] Todos todos) { if (ModelState.IsValid) { _context.Add(todos); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(todos)); }
public async Task <IActionResult> Create([Bind("Id,UserName,NormalizedUserName,Email,NormalizedEmail,EmailConfirmed,PasswordHash,SecurityStamp,ConcurrencyStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEnd,LockoutEnabled,AccessFailedCount")] AspNetUsers aspNetUsers) { if (ModelState.IsValid) { _context.Add(aspNetUsers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(aspNetUsers)); }
public async Task <IActionResult> Create([Bind("Id,Title,Description,TodoId")] Tasks tasks) { if (ModelState.IsValid) { _context.Add(tasks); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TodoId"] = new SelectList(_context.Todos, "Id", "Title", tasks.TodoId); return(View(tasks)); }
public async Task <IActionResult> Create([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)); }
public async Task <IActionResult> Create([Bind("UserId,RoleId")] AspNetUserRoles aspNetUserRoles) { if (ModelState.IsValid) { _context.Add(aspNetUserRoles); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.AspNetRoles, "Id", "Id", aspNetUserRoles.RoleId); // First ID = ViewData["UserId"] = new SelectList(_context.AspNetUsers, "Id", "Id", aspNetUserRoles.UserId); return(View(aspNetUserRoles)); }
public async Task <IActionResult> Create([Bind("Id,TaskId,UserId,BeginTask,EndTask,State")] UserTasks userTasks) { if (ModelState.IsValid) { _context.Add(userTasks); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TaskId"] = new SelectList(_context.Tasks, "Id", "Description", userTasks.TaskId); ViewData["UserId"] = new SelectList(_context.AspNetUsers, "Id", "Id", userTasks.UserId); return(View(userTasks)); }