Ejemplo n.º 1
0
        public ActionResult Add(NavigationLink l, string webPageId, string tabId, string sectionId)
        {
            if (ModelState.IsValid)
            {
                DBDataContext db = Utils.DB.GetContext();

                l.Position = db.NavigationLinks.Where(x=>x.SectionID == Convert.ToInt32(sectionId)).Count() + 1;
                Section s = db.Sections.SingleOrDefault(x => x.ID == Convert.ToInt32(sectionId));
                if (s != null)
                {
                    s.NavigationLinks.Add(l);
                    l.WebPageID = Convert.ToInt32(webPageId);

                    try
                    {
                        db.SubmitChanges();
                        return RedirectToAction("Index", "Link", new { controller = "Link", tab = tabId, section = sectionId });
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.Report.Exception(ex, "Links/Add");
                        ModelState.AddModelError("", "An unknown error occurred. Please try again in few minutes.");
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Section does not exist in the database");
                }
            }

            ViewData["Title"] = "Add Link";
            ViewData["Action"] = "Add";
            ViewData["TabID"] = tabId;
            ViewData["SectionID"] = sectionId;
            return View("Manage");
        }
Ejemplo n.º 2
0
 partial void DeleteNavigationLink(NavigationLink instance);
Ejemplo n.º 3
0
 partial void UpdateNavigationLink(NavigationLink instance);
Ejemplo n.º 4
0
 partial void InsertNavigationLink(NavigationLink instance);
Ejemplo n.º 5
0
		private void detach_NavigationLinks(NavigationLink entity)
		{
			this.SendPropertyChanging();
			entity.WebPage = null;
		}
Ejemplo n.º 6
0
		private void attach_NavigationLinks(NavigationLink entity)
		{
			this.SendPropertyChanging();
			entity.Section = this;
		}