public async Task <IActionResult> Create([Bind("Id,CategoryName,Description,IsEnabled")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("Id,country_name,is_enabled")] Country country) { if (ModelState.IsValid) { _context.Add(country); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Create([Bind("Id,CityName,PostalZip,IsEnabled,CountryId")] City city) { if (ModelState.IsValid) { _context.Add(city); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Id", city.CountryId); return(View(city)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,JoinedDate,IsActivated,CityId,Street")] Author author) { if (ModelState.IsValid) { _context.Add(author); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Id", author.CityId); return(View(author)); }
public async Task <IActionResult> Create([Bind("Id,BookId,Title,Content,ModifiedDate,ModifiedBy,IsEnabled")] Chapter chapter) { if (ModelState.IsValid) { _context.Add(chapter); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Books, "Id", "Id", chapter.BookId); return(View(chapter)); }
public async Task <IActionResult> Create([Bind("Id,BookId,ModifiedDate,ModifiedBy")] BookCover bookCover) { if (ModelState.IsValid) { _context.Add(bookCover); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Books, "Id", "Id", bookCover.BookId); return(View(bookCover)); }
public async Task <IActionResult> Create([Bind("Id,Title,Description,AuthorId,ModifiedDate,ModifiedBy,IsPublished,CategoryId")] Book book) { if (ModelState.IsValid) { _context.Add(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AuthorId"] = new SelectList(_context.Authors, "Id", "Id", book.AuthorId); ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Id", book.CategoryId); return(View(book)); }