public async Task <IActionResult> Create([Bind("Description,University,Id,Name,Lastname,Phone,Genre,Email,Birthdate")] Speaker speaker) { if (ModelState.IsValid) { _context.Add(speaker); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(speaker)); }
public async Task <IActionResult> Create(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,date,name,isHoliday,holidayCategory,description")] Calendar calendar) { if (ModelState.IsValid) { _context.Add(calendar); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(calendar)); }
public async Task <IActionResult> Create([Bind("ID,Title,ReleaseDate,Genre,Price")] Todo todo) { if (ModelState.IsValid) { _context.Add(todo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(todo)); }
public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price,Rating")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(movie)); //this line is hit if there are validation errors, so the same screen will be re-dispalyed. }
public async Task <IActionResult> Create([Bind("Id,Forename,Surname,DOB")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Create([Bind("Id,Nama,Jadwal")] Booking booking) { if (ModelState.IsValid) { _context.Add(booking); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(booking)); }
public async Task <IActionResult> Create([Bind("ID,Titulo,DataLancamento,Genero,Preco,Avaliacao")] 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,sub,mark")] Subjects subjects) { if (ModelState.IsValid) { _context.Add(subjects); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(subjects)); }
public async Task <IActionResult> Create([Bind("Id,Title")] Genre genre) { if (ModelState.IsValid) { _context.Add(genre); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(genre)); }
public async Task <IActionResult> Create([Bind("ID,Name")] Director director) { if (ModelState.IsValid) { _context.Add(director); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(director)); }
public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,DOB,Email")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(user)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Title,Genre")] Book book) { if (ModelState.IsValid) { _context.Add(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(book)); }
public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price,Rating")] 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,Name,IsDone,Priority")] ToDo toDo) { if (ModelState.IsValid) { _context.Add(toDo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(toDo)); }
public async Task <IActionResult> Create([Bind("Id,Name,Code")] Language language) { if (ModelState.IsValid) { _context.Add(language); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(language)); }
public async Task <IActionResult> Create([Bind("CommentsToDoId,Name,Content,ToDoId")] CommentsToDo commentsToDo) { if (ModelState.IsValid) { _context.Add(commentsToDo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ToDoId"] = new SelectList(_context.ToDo, "ToDoId", "ToDoId", commentsToDo.ToDoId); return(View(commentsToDo)); }
public async Task <IActionResult> SendReview([Bind("Id,Name,Review,ReviewDate")] Comments comments) { if (ModelState.IsValid) { _context.Add(comments); comments.ReviewDate = DateTime.Now; await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Details))); } return(View(comments)); }
public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price,Stock,Director,Description,ImageURL")] Movie movie) { // PERFORMS SERVER-SIDE VALIDATION - confirmed working with javascript disabled on client. if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Create([Bind("ID,Title,ReleaseDate,Genre,Price,Rating,DiretorID")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DiretorID"] = new SelectList(_context.Diretor, "ID", "Name", movie.DiretorID); return(View(movie)); }
public async Task <IActionResult> Create([Bind("CourseID,Title,Credits,DepartmentID")] Course course) { if (ModelState.IsValid) { _context.Add(course); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } PopulateDepartmentsDropDownList(course.DepartmentID); return(View(course)); }
public async Task <IActionResult> Create([Bind("s_code,p_name,SellDate,s_amount,Price,Rating")] Sell sell) { if (ModelState.IsValid) { _context.Add(sell); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["p_name"] = new SelectList(_context.Product, "p_name", "p_name", sell.p_name); return(View(sell)); }
public async Task <IActionResult> Create([Bind("UserID,UserName,UserReview,ReviewDate")] User user) { if (ModelState.IsValid) { user.UserID = Guid.NewGuid(); _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Create([Bind("Id,Name,Author,ISBN")] Book book) { if (ModelState.IsValid) { await _context.AddAsync(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(book)); }
//[ValidateAntiForgeryToken] public async Task <IActionResult> CreateMovie(Movie movie) { if (ModelState.IsValid) { _context.Add(movie); var result = await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); return(Json(result > 0 ? new { code = 0, msg = "添加成功" } : new { code = 1, msg = "网络打瞌睡了!" })); } return(Json(new { code = 0, msg = "数据验证失败" })); }
public async Task <IActionResult> Create([Bind("MovieId,Title,ReleaseDate,GenreId,Price,Image")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } //ViewData["GenreId"] = new SelectList(_context.Genre, "GenreId", "GenreId", movie.GenreId); return(View(movie)); }
public async Task <IActionResult> CreateReview([Bind("Id,IdMovie,Reviewer,Text")] Review review) { review.ReviewDate = DateTime.Now; if (ModelState.IsValid) { _context.Add(review); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(RedirectToAction("Index", "Home")); }
public async Task <IActionResult> Create([Bind("ReviewId,Title,Content,MovieId")] Review review) { if (ModelState.IsValid) { _context.Add(review); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MovieId"] = new SelectList(_context.Movie, "Id", "Title", review.MovieId); return(View(review)); }
public async Task <IActionResult> Create(int id, [Bind("ReviewsID,Reviewer,Review,MovieID")] Reviews reviews) { if (ModelState.IsValid) { _context.Add(reviews); await _context.SaveChangesAsync(); return(RedirectToAction("Details", "Movies", new { ID = reviews.MovieID })); } ViewData["MovieID"] = new SelectList(_context.Movie, "ID", "Title", reviews.MovieID); return(View(reviews)); }
public async Task <IActionResult> Create([Bind("ID,Title,ReleaseDate,Genre,Price,ImageURL,TrailerURL,Description")] Movie movie) { ViewBag.totalItems = HttpContext.Session.GetInt32("totalItems") != null?HttpContext.Session.GetInt32("totalItems") : 0; if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(AdminIndex))); } return(View(movie)); }