public ActionResult DeleteConfirmed(int id) { try { Wva wva = db.Wva.Find(id); db.Wva.Remove(wva); List <BadBee.Core.DAL.BadBee> badbee = db.BadBee.Where(q => q.WvaId == id).ToList(); foreach (var item in badbee) { db.BadBee.Remove(item); } db.SaveChanges(); GlobalVars.DictionaryCache = new Dictionary <Type, object>(); BadBee.Core.Providers.ListProvider.FillDictionaryCache(); return(RedirectToAction("Index")); } catch (Exception ex) { log.Error(ex); throw ex; } }
public ActionResult Edit([Bind(Include = "Name,Id")] Wva wva) { try { if (ModelState.IsValid) { db.Entry(wva).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(wva)); } catch (Exception ex) { log.Error(ex); throw ex; } }
// GET: Wvas/Delete/5 public ActionResult Delete(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Wva wva = db.Wva.Find(id); if (wva == null) { return(HttpNotFound()); } return(View(wva)); } catch (Exception ex) { log.Error(ex); throw ex; } }