Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Price")] Produit produit)
        {
            if (ModelState.IsValid)
            {
                _context.Add(produit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(produit));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre")] Book book)
        {
            if (ModelState.IsValid)
            {
                _context.Add(book);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("ID,Nome,Sobrenome,RA,Curso,Status,DataInicio,DataTermino,Email,Telefone,Escola,Endereço,CPF")] Aluno aluno)
        {
            if (ModelState.IsValid)
            {
                _context.Add(aluno);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(aluno));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("ID,tytul,data_wydania,gatunek,cena,ocena")] Game game)
        {
            if (ModelState.IsValid)
            {
                _context.Add(game);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(game));
        }
        public async Task <IActionResult> Create([Bind("Id,Nome")] Departments departments)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departments);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departments));
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Author author)
        {
            if (ModelState.IsValid)
            {
                _context.Add(author);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(author));
        }
 public void Insert(Seller Seller)
 {
     // Seller.Departments = _context.Departments.First();
     _context.Add(Seller);
     _context.SaveChanges();
 }