Beispiel #1
0
        public ActionResult Create([Bind(Include = "Id,Nome,DataLancamento")] Dex.TrocaGames.Dominio.Console console)
        {
            if (ModelState.IsValid)
            {
                _repositorio.Insert(console);
                return(RedirectToAction("Index"));
            }

            return(View(console));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "Id,Nome,Endereco")] Lugar lugar)
        {
            if (ModelState.IsValid)
            {
                _repositorio.Insert(lugar);
                return(RedirectToAction("Index"));
            }

            return(View(lugar));
        }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "Id,Nome,DataLancamento,Genero,FaixaEtaria")] JogoEdicaoViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                Jogo jogo = Mapper.Map <JogoEdicaoViewModel, Jogo>(viewModel);
                _repositorio.Insert(jogo);
                return(RedirectToAction("Index"));
            }

            return(View(viewModel));
        }
        public ActionResult Create([Bind(Include = "Id,Nome,Idade,JogoId")] JogadorEdicaoViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                Jogador jogador = Mapper.Map <JogadorEdicaoViewModel, Jogador>(viewModel);
                _repositorioJogador.Insert(jogador);
                return(RedirectToAction("Index"));
            }

            CriarListaJogosViewBag();
            //ViewBag.JogoId = new SelectList(db.Jogos, "Id", "Nome", jogador.JogoId);
            return(View(viewModel));
        }
        public void AddAnuncio(Anuncio anuncio, ApplicationUser user)
        {
            if (user != null)
            {
                anuncio.Anunciante = user;

                _repo.Insert(anuncio);
                _repo.Save();
            }
            else
            {
                throw new KeyNotFoundException("User email not found");
            }
        }
Beispiel #6
0
 public void Inserir(TEntity obj)
 {
     try
     {
         repositorio.BeginTransaction();
         repositorio.Insert(obj);
         repositorio.Commit();
     }
     catch (Exception ex)
     {
         repositorio.Rollback();
         throw new Exception(ex.Message);
     }
 }
Beispiel #7
0
        public void AgregarTickets(TipoTicket tipo, int cantidad, ApplicationUser user)
        {
            if (user == null)
            {
                throw new Exception("Usuario no encontrado");
            }

            for (int ind = 1; ind <= cantidad; ind++)
            {
                _tickets.Insert(new Ticket()
                {
                    TipoTicket = tipo,
                    Usuario    = user
                });
            }

            _tickets.Save();
        }