public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Address,City,Country,Gender")] 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,Name,Abbrivation,IsEnabled")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email,Mobileno,ContactPerson,IsEnabled")] Publisher publisher)
        {
            if (ModelState.IsValid)
            {
                _context.Add(publisher);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(publisher));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,IssueDate,BookId,CustomerId,NoOfDays,Rate,Amount")] Issue issue)
        {
            if (ModelState.IsValid)
            {
                _context.Add(issue);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"]     = new SelectList(_context.Book, "Id", "Id", issue.BookId);
            ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Id", issue.CustomerId);
            return(View(issue));
        }
        public async Task <IActionResult> Create([Bind("Id,BookName,BookDescription,CategoryId,PublisherId,AuthorId,Price,PublishYear,InStock")] Book book)
        {
            if (ModelState.IsValid)
            {
                _context.Add(book);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AuthorId"]    = new SelectList(_context.Author, "Id", "Id", book.AuthorId);
            ViewData["CategoryId"]  = new SelectList(_context.Category, "Id", "Id", book.CategoryId);
            ViewData["PublisherId"] = new SelectList(_context.Publisher, "Id", "Id", book.PublisherId);
            return(View(book));
        }