public async Task <ActionResult <Impedimento> > Get(Guid id) { Impedimento impedimento = await _unitOfWork.ImpedimentoRepository.GetAsync(id); if (impedimento == null) { return(NotFound()); } return(Ok(impedimento)); }
public ActionResult Edit([Bind(Include = "ID,NomeLike,AmigoID")] Impedimento impedimento) { if (ModelState.IsValid) { db.Entry(impedimento).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AmigoID = new SelectList(db.Amigos, "ID", "Nome", impedimento.AmigoID); return(View(impedimento)); }
public bool AlterarImpedimento(Impedimento impedimento) { int qtdAlterada; using (SqlConnection conexaoDB = this.Conexao()) { string sql = "update Impedimento set TipoImpedimento = @TipoImpedimento where IdImpedimento = @IdImpedimento"; qtdAlterada = conexaoDB.Execute(sql, impedimento); } return(qtdAlterada > 0 && qtdAlterada > -1); }
public List <Impedimento> ListarImpedimentos(Impedimento impedimento) { List <Impedimento> impedimentos; using (SqlConnection conexaoDB = this.Conexao()) { string sql = " select TipoImpedimento from Impedimento Where (@IdImpedimento is null or @IdImpedimento = 0) or(IdImpedimento = @IdImpedimento) and(@TipoImpedimento is null) or(TipoImpedimento = @TipoImpedimento)"; impedimentos = conexaoDB.Query <Impedimento>(sql, impedimento).ToList(); } return(impedimentos); }
public ActionResult Create([Bind(Include = "ID,NomeLike,AmigoID")] Impedimento impedimento) { if (ModelState.IsValid) { db.Impedimentoes.Add(impedimento); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AmigoID = new SelectList(db.Amigos, "ID", "Nome", impedimento.AmigoID); return(View(impedimento)); }
// GET: Impedimentos/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Impedimento impedimento = db.Impedimentoes.Find(id); if (impedimento == null) { return(HttpNotFound()); } return(View(impedimento)); }
// GET: Impedimentos/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Impedimento impedimento = db.Impedimentoes.Find(id); if (impedimento == null) { return(HttpNotFound()); } ViewBag.AmigoID = new SelectList(db.Amigos, "ID", "Nome", impedimento.AmigoID); return(View(impedimento)); }
public async Task <IActionResult> Delete(Guid id) { Impedimento obj = await _unitOfWork.ImpedimentoRepository.GetAsync(id); if (obj == null) { return(NotFound()); } await _unitOfWork.ImpedimentoRepository.RemoveAsync(id); await _unitOfWork.SaveChangesAsync(); return(NoContent()); }
public void modificarImpedimento(bool afectado, string nombre, string descripcion) { Impedimento i = obtenerImpedimento(); if (afectado) { i.Nombre = nombre; i.Descripcion = descripcion; } else { i.Nombre = "Estado: Normal"; i.Descripcion = "No estás siendo afectado por ninguna eventualidad."; } i.Afectado = afectado; }
public async Task <OperationResult> Handle(RemoveImpedimentoCommand request, CancellationToken cancellationToken) { Impedimento obj = await _unitOfWork.ImpedimentoRepository.GetAsync(request.Id); if (obj == null) { return(OperationResult.NotFound); } await _unitOfWork.ImpedimentoRepository.RemoveAsync(request.Id); bool success = await _unitOfWork.SaveChangesAsync(); OperationResult result = success ? OperationResult.Success : OperationResult.Failed; return(result); }
void Update() { if (!votar) { if (refreshTime > 0) { refreshTime -= Time.deltaTime; } else { refreshTime = 3.0f; controlador.actualizarEstado(); switch (controlador.obtenerEstadoPartida()) { case "conexion": bienvenida.SetActive(true); detalle.SetActive(false); break; case "iniciada": Impedimento i = controlador.obtenerImpedimento(); bienvenida.SetActive(false); detalle.SetActive(true); estado.text = i.Nombre; descripcion.text = i.Descripcion; if (i.Afectado) { estado.color = rojoImpedimento; descripcion.color = rojoImpedimento; } else { estado.color = azulNormal; descripcion.color = azulNormal; } break; case "encuesta": this.gameObject.SetActive(false); controlador.mostrarVistaEncuesta(); break; } } } }
public async Task UpdateImpedimentoCommand_Handle() { // Arrange IUnitOfWork unitOfWork = DbContextHelper.GetContext(); IMapper mapper = AutoMapperHelper.GetMappings(); Guid impedimentoId = Guid.NewGuid(); DateTime dataInclusao = DateTime.Now; Impedimento impedimento = MockEntityHelper.GetNewImpedimento(impedimentoId); await unitOfWork.ImpedimentoRepository.AddAsync(impedimento); await unitOfWork.SaveChangesAsync(); unitOfWork.ImpedimentoRepository.Detatch(impedimento); UpdateImpedimentoCommand request = new() { Impedimento = MockViewModelHelper.GetNewImpedimento(impedimentoId, dataInclusao) }; GetImpedimentoQuery request2 = new() { Id = impedimentoId }; // Act ImpedimentoHandler handler = new(unitOfWork, mapper); OperationResult response = await handler.Handle(request, CancellationToken.None); ImpedimentoViewModel response2 = await handler.Handle(request2, CancellationToken.None); // Assert Assert.True(response == OperationResult.Success); Assert.True(response2 != null); Assert.True(response2.Id == impedimentoId); Assert.True(response2.DataInclusao.Ticks == dataInclusao.Ticks); } }
public bool UpdateImpedimento(Impedimento impedimento) { bool alterado = Dao.AlterarImpedimento(impedimento); return(alterado); }
public bool InserirImpedimento(Impedimento impedimento) { bool inserido = Dao.InserirImpedimento(impedimento); return(inserido); }
public List <Impedimento> listarImpedimentos(Impedimento impedimento) { List <Impedimento> impedimentos = Dao.ListarImpedimentos(impedimento); return(impedimentos.Count > 0 ? impedimentos : new List <Impedimento>()); }
public Jugador(string nombre) { this.nombre = nombre; Estado = new Impedimento(); avatar = "none"; }
public void borrarDatos() { id = 0; avatar = "none"; Estado = new Impedimento(); }