Beispiel #1
0
        public ActionResult EditSidebar(SidebarView model)
        {
            using (DBLayer db = new DBLayer())
            {
                SidebarDTOcs sidebardto = db.Sidebar.Find(1);
                sidebardto.Body = model.Body;
                db.SaveChanges();
            }
            TempData["SM"] = "You have made changes to the sidebar";

            return(RedirectToAction("EditSidebar"));
        }
        public ActionResult SidebarPartial()
        {
            // this part delcares the dto
            SidebarView model;

            // this part of the code iniilises the mode
            using (DBLayer db = new DBLayer())
            {
                SidebarDTOcs dto = db.Sidebar.Find(1);

                model = new SidebarView(dto);
            }

            // Return partial view with model
            return(PartialView(model));
        }
Beispiel #3
0
        public ActionResult EditSidebar()

        {
            SidebarView model;


            using (DBLayer db = new DBLayer())
            {
                //this part access the sidebar class
                SidebarDTOcs sidebardto = db.Sidebar.Find(1);

                //this intialiess the model
                model = new SidebarView(sidebardto);
            }
            return(View(model));
        }
Beispiel #4
0
 public SidebarView(SidebarDTOcs rowposition)
 {
     Id   = rowposition.Id;
     Body = rowposition.Body;
 }