Example #1
0
        public ActionResult AddKararlar(KararlarVM model)
        {
            KararlarVM vmodel = new KararlarVM();

            vmodel.drpCategories = DrpServices.getDrpCategries();

            if (ModelState.IsValid)
            {
                Kararlar kr = new Kararlar();
                kr.CategoryID = model.CategoryID;
                kr.Title      = model.Title;
                kr.Content    = model.Content;

                db.Kararlars.Add(kr);
                db.SaveChanges();

                ViewBag.IslemDurum = 1;
                return(RedirectToAction("index"));
            }
            else
            {
                ViewBag.IslemDurum = 2;
                return(View(vmodel));
            }
        }
Example #2
0
        // GET: Kararlar
        public ActionResult Index(string title, int id)
        {
            Kararlar       kr    = db.Kararlars.FirstOrDefault(x => x.ID == id);
            SiteKararlarVM model = new SiteKararlarVM();

            model.CategoryName = kr.Category.Name;
            model.Content      = kr.Content;
            model.Title        = kr.Title;

            return(View(model));
        }
Example #3
0
        public ActionResult UpdateKararlar(int id)
        {
            Kararlar   kr    = db.Kararlars.FirstOrDefault(x => x.ID == id);
            KararlarVM model = new KararlarVM();

            model.CategoryID    = kr.CategoryID;
            model.Content       = kr.Content;
            model.drpCategories = DrpServices.getDrpCategries();
            model.Title         = kr.Title;

            return(View(model));
        }
Example #4
0
        public ActionResult UpdateKararlar(KararlarVM mdl)
        {
            mdl.drpCategories = DrpServices.getDrpCategries();
            if (ModelState.IsValid)
            {
                Kararlar kr = db.Kararlars.FirstOrDefault(x => x.ID == mdl.ID);
                kr.CategoryID = mdl.CategoryID;
                kr.Content    = mdl.Content;
                kr.Title      = mdl.Title;

                db.SaveChanges();
                ViewBag.IslemDurum = 1;
                return(View(mdl));
            }
            else
            {
                ViewBag.IslemDurum = 2;
                return(View(mdl));
            }
        }