public async Task <IHttpActionResult> PutReuniao(int id, Reuniao reuniao) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != reuniao.Id) { return(BadRequest()); } db.Entry(reuniao).State = EntityState.Modified; db.DadoAlterado.Add(new DadoAlterado { Entidade = reuniao.GetType().Name, IdDado = reuniao.Id }); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReuniaoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Data_reuniao,Horario_inicio,Horario_fim,Local_reuniao")] Reuniao reuniao) { if (ModelState.IsValid) { db.Entry(reuniao).State = EntityState.Modified; db.DadoAlterado.Add(new DadoAlterado { Entidade = reuniao.GetType().Name, IdDado = reuniao.Id }); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(reuniao)); }
public async Task <ActionResult> DeleteConfirmed(int id) { Reuniao reuniao = await db.reuniao.FindAsync(id); db.reuniao.Remove(reuniao); await db.SaveChangesAsync(); db.DadoExcluido.Add(new DadoExcluido { Entidade = reuniao.GetType().Name, IdDado = id }); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> DeleteReuniao(int id) { Reuniao reuniao = await db.reuniao.FindAsync(id); if (reuniao == null) { return(NotFound()); } db.reuniao.Remove(reuniao); await db.SaveChangesAsync(); db.DadoExcluido.Add(new DadoExcluido { Entidade = reuniao.GetType().Name, IdDado = id }); await db.SaveChangesAsync(); return(Ok(reuniao)); }