public async Task <IActionResult> Create([Bind("Name,Surname,Email,Password,Id")] Member member) { if (ModelState.IsValid) { member.Id = Guid.NewGuid(); _context.Add(member); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(member)); }
public async Task <IActionResult> Create([Bind("Title,Author,Edition,Year,Quantity,Id")] Book book) { if (ModelState.IsValid) { book.Id = Guid.NewGuid(); _context.Add(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(book)); }
public async Task <IActionResult> Create([Bind("IsReturned,RequestedOn,ReturnedOn,MemberId,BookId,Id")] Lend lend) { if (ModelState.IsValid) { lend.Id = Guid.NewGuid(); _context.Add(lend); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Books, "Id", "Id", lend.BookId); ViewData["MemberId"] = new SelectList(_context.Members, "Id", "Id", lend.MemberId); return(View(lend)); }