Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Image,Writer,Caterory,Price,Stock,Date,Summary")] Book book)
        {
            if (ModelState.IsValid)
            {
                _context.Add(book);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
        public async Task <IActionResult> Create([Bind("id,name,email,password,role")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(user));
        }