public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Create([Bind("Id,Title,Date,Importance,Content,Deadline,ID_User")] ToDo toDo) { var current_User = UserManager.GetUserAsync(HttpContext.User).Result; if (null != current_User) { if (ModelState.IsValid) { toDo.User = current_User; _context.Add(toDo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(toDo)); } return(View("ErreurPasConnecte")); }