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)); }
public ActionResult Create([Bind(Include = "Id,Nome,Endereco")] Lugar lugar) { if (ModelState.IsValid) { _repositorio.Insert(lugar); return(RedirectToAction("Index")); } return(View(lugar)); }
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"); } }
public void Inserir(TEntity obj) { try { repositorio.BeginTransaction(); repositorio.Insert(obj); repositorio.Commit(); } catch (Exception ex) { repositorio.Rollback(); throw new Exception(ex.Message); } }
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(); }