예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,Publisher_Name,Mobile_Number,Email_Id")] Publisher publisher)
        {
            if (ModelState.IsValid)
            {
                _context.Add(publisher);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(publisher));
        }
예제 #2
0
      public async Task <IActionResult> Create([Bind("Id,Name,Email_Id,Address,Mobile_Number")] Author author)
      {
          if (ModelState.IsValid)
          {
              _context.Add(author);
              await _context.SaveChangesAsync();

              return(RedirectToAction(nameof(Index)));
          }
          return(View(author));
      }
예제 #3
0
      public async Task <IActionResult> Create([Bind("Id,Tittle,Discription,Price,AuthorId")] Book book)
      {
          if (ModelState.IsValid)
          {
              _context.Add(book);
              await _context.SaveChangesAsync();

              return(RedirectToAction(nameof(Index)));
          }
          ViewData["AuthorId"] = new SelectList(_context.Set <Author>(), "Id", "Email_Id", book.AuthorId);
          return(View(book));
      }
      public async Task <IActionResult> Create([Bind("Id,Books_Copies,PublisherId,BookId")] Publication publication)
      {
          if (ModelState.IsValid)
          {
              _context.Add(publication);
              await _context.SaveChangesAsync();

              return(RedirectToAction(nameof(Index)));
          }
          ViewData["BookId"]      = new SelectList(_context.Book, "Id", "Tittle", publication.BookId);
          ViewData["PublisherId"] = new SelectList(_context.Set <Publisher>(), "Id", "Publisher_Name", publication.PublisherId);
          return(View(publication));
      }