Exemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] Model.Emprestimo amigo)
        {
            if (amigo == default(API.Model.Emprestimo))
            {
                return(BadRequest());
            }

            var item = await _emprestimoRepository.AddAsync(amigo);

            return(Accepted(item));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,DataEmprestimo,DataDevolucao,JogoId,AmigoId")] Emprestimo emprestimo)
        {
            if (ModelState.IsValid)
            {
                await _emprestimoRepository.AddAsync(emprestimo);

                return(RedirectToAction(nameof(Index)));
            }
            CarregarListJogo(emprestimo.JogoId);
            CarregarListAmigo(emprestimo.AmigoId);
            return(View(emprestimo));
        }