public PartialViewResult GetCategoryPartial()
        {
            List <Category> list = CacheHelpers.GetCategoriesFromCache();


            return(PartialView("_CategoriesPage1", list));
        }
Example #2
0
        public ActionResult Edit(Note note, int CategoryID)
        {
            ModelState.Remove("CreatedOn");
            ModelState.Remove("ModifiedOn");
            ModelState.Remove("ModifiedUsername");

            if (ModelState.IsValid)
            {
                Note     res = noteManager.Find(x => x.ID == note.ID);
                Category cat = categoryManager.Find(x => x.ID == CategoryID);

                res.isDraft  = note.isDraft;
                res.Category = cat;
                res.Text     = note.Text;
                res.Title    = note.Title;

                noteManager.Update(res);

                return(RedirectToAction("Index"));
            }

            ViewBag.Categories = new SelectList(CacheHelpers.GetCategoriesFromCache(), "ID", "Title");

            return(View(note));
        }
Example #3
0
        // GET: Note/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Note note = noteManager.Find(x => x.ID == id);

            if (note == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Categories = new SelectList(CacheHelpers.GetCategoriesFromCache(), "ID", "Title");

            return(View(note));
        }
Example #4
0
        public ActionResult Create(Note note, int CategoryID)
        {
            ModelState.Remove("CreatedOn");
            ModelState.Remove("ModifiedOn");
            ModelState.Remove("ModifiedUsername");


            if (ModelState.IsValid)
            {
                Category cat = categoryManager.Find(x => x.ID == CategoryID);
                note.Owner = CSession.User;

                note.Category = cat;

                noteManager.insert(note);
                return(RedirectToAction("Index"));
            }

            //Cacheleme yapılacak
            ViewBag.Categories = new SelectList(CacheHelpers.GetCategoriesFromCache(), "id", "Title");

            return(View(note));
        }
 public ActionResult Index()
 {
     return(View(CacheHelpers.GetCategoriesFromCache()));
 }
Example #6
0
        // GET: Note/Create
        public ActionResult Create()
        {
            ViewBag.Categories = new SelectList(CacheHelpers.GetCategoriesFromCache(), "ID", "Title");

            return(View());
        }