コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        public ActionResult Create()
        {
            var structure = new StructureView();

            return View(structure);
        }