Exemple #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));
            }
        }
Exemple #2
0
        public ActionResult AddKararlar()
        {
            KararlarVM model = new KararlarVM();

            model.drpCategories = DrpServices.getDrpCategries();



            return(View(model));
        }
Exemple #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));
        }
Exemple #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));
            }
        }