예제 #1
0
        public async Task <IActionResult> Create([Bind("AmigoID,Nome,Telefone,Email")] Amigo amigo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(amigo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(amigo));
        }
        public async Task <IActionResult> Devolver([Bind("EmprestimoID,DataDevolucao")] Emprestimo emprestimo)
        {
            var emprestimo_tmp = await _context.Emprestimo
                                 .SingleOrDefaultAsync(m => m.EmprestimoID == emprestimo.EmprestimoID);

            emprestimo_tmp.DataDevolucao = emprestimo.DataDevolucao;

            _context.Update(emprestimo_tmp);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index", "Home"));
        }
        public async Task <IActionResult> Create([Bind("JogoID,Titulo,Quantidade,Foto")] Jogo jogo, List <IFormFile> files)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jogo);
                await _context.SaveChangesAsync();

                jogo.Foto = await RealizarUploadImagens(files, jogo.JogoID);

                _context.Update(jogo);
                await _context.SaveChangesAsync();

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