コード例 #1
0
        //
        // GET: /ConditionTemplate/Delete/5

        public ActionResult Delete(int id)
        {
            IRepository <Models.Condition> repo = new ConditionTemplateRepository();

            repo.Delete(repo.GetById(id));
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         IRepository <Models.Condition> repo = new ConditionTemplateRepository();
         repo.Delete(repo.GetById(id));
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #3
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
                string    name      = collection.Get("Name");
                Condition condition = new Condition()
                {
                    ID = id, Name = name
                };

                IRepository <Condition> repo = new ConditionTemplateRepository();
                repo.Update(condition);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #4
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                string    name      = collection.Get("Name");
                Condition condition = new Condition()
                {
                    Name = name
                };

                IRepository <Condition> repo = new ConditionTemplateRepository();
                repo.Save(condition);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #5
0
        //
        // GET: /ConditionTemplate/Edit/5

        public ActionResult Edit(int id)
        {
            IRepository <Condition> repo = new ConditionTemplateRepository();

            return(View(repo.GetById(id)));
        }
コード例 #6
0
        //
        // GET: /ConditionTemplate/

        public ActionResult Index()
        {
            IRepository <Models.Condition> repo = new ConditionTemplateRepository();

            return(View(repo.GetAll()));
        }