// GET: AgenciasBancarias/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AgenciaBancaria agenciaBancaria = await RedisCacheClient.GetAsync <AgenciaBancaria>("AgenciaBancaria:" + id) ?? await db.AgenciasBancarias.FindAsync(id); if (agenciaBancaria == null) { return(HttpNotFound()); } return(View(agenciaBancaria)); }
// GET: AgenciasBancarias/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AgenciaBancaria agenciaBancaria = await db.AgenciasBancarias.FindAsync(id); if (agenciaBancaria == null) { return(HttpNotFound()); } return(View(agenciaBancaria)); }
// GET: AgenciasBancarias/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AgenciaBancaria agenciaBancaria = await db.AgenciasBancarias.FindAsync(id); if (agenciaBancaria == null) { return(HttpNotFound()); } ViewBag.BancoId = new SelectList(db.Bancos, "BancoId", "Nome", agenciaBancaria.BancoId); return(View(agenciaBancaria)); }
public async Task <ActionResult> DeleteConfirmed(int id) { using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { AgenciaBancaria agenciaBancaria = await db.AgenciasBancarias.FindAsync(id); db.AgenciasBancarias.Remove(agenciaBancaria); await db.SaveChangesAsync(); await RedisCacheClient.RemoveAsync("AgenciaBancaria:" + id); scope.Complete(); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "AgenciaBancariaId,BancoId,CodigoCompensacao,Nome")] AgenciaBancaria agenciaBancaria) { if (ModelState.IsValid) { using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { db.Entry(agenciaBancaria).State = EntityState.Modified; await db.SaveChangesAsync(); await RedisCacheClient.ReplaceAsync("AgenciaBancaria:" + agenciaBancaria.AgenciaBancariaId, agenciaBancaria, new TimeSpan(0, 5, 0)); scope.Complete(); return(RedirectToAction("Index")); } } ViewBag.BancoId = new SelectList(db.Bancos, "BancoId", "Nome", agenciaBancaria.BancoId); return(View(agenciaBancaria)); }