public ActionResult Delete(long id, StructureView structureView) { try { var dataBaseManager = (DataBaseManager)HttpContext.Items["DataBaseManager"]; dataBaseManager.Structure.Delete(id); return RedirectToAction("Index"); } catch { ModelState.AddGlobalError("An error has occured, please try again."); return View(); } }
public ActionResult Create(StructureView structure) { if (!ModelState.IsValid) return View(structure); try { var dataBaseManager = (DataBaseManager)HttpContext.Items["DataBaseManager"]; var dbStructure = dataBaseManager.Structure.Create(structure.Name, structure.Description, structure.Public, User.Identity.Name); return RedirectToAction("Design", new { id = dbStructure.Id }); } catch { ModelState.AddGlobalError("An error has occured, please try again."); return View(); } }
public ActionResult Create() { var structure = new StructureView(); return View(structure); }