public async Task <IActionResult> Create([Bind("Id,Name")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,Descricao,Preco")] Products products)
        {
            if (ModelState.IsValid)
            {
                _context.Add(products);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(products));
        }
        public async Task <IActionResult> Create([Bind("DonoId,Nome,Telefone")] Dono dono)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dono);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dono));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("CachorroId,Nome,DonoId")] Cao cao)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cao);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DonoId"] = new SelectList(_context.Dono, "DonoId", "DonoId", cao.DonoId);
            return(View(cao));
        }
 public async Task InsertAsync(Seller obj)
 {
     _context.Add(obj);
     await _context.SaveChangesAsync();
 }