public ActionResult Edit(int id, Tarjeta_Credito tarjeta_Credito) { try { using (DbModels dbModel = new DbModels()) { dbModel.Entry(tarjeta_Credito).State = EntityState.Modified; dbModel.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(Tarjeta_Credito tarjeta_Credito) { try { using (DbModels dbModels = new DbModels()) { dbModels.Tarjeta_Credito.Add(tarjeta_Credito); dbModels.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { using (DbModels dbModel = new DbModels()) { Tarjeta_Credito tarjeta_Credito = dbModel.Tarjeta_Credito.Where(x => x.Numero_Tarjeta == id).FirstOrDefault(); dbModel.Tarjeta_Credito.Remove(tarjeta_Credito); dbModel.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }