예제 #1
0
        //
        // GET: /WindTemplate/Delete/5

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

            repo.Delete(repo.GetById(id));
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         IRepository <Models.Wind> repo = new WindRepository();
         repo.Delete(repo.GetById(id));
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
예제 #3
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                string name = collection.Get("Name");
                Wind   wind = new Wind()
                {
                    ID = id, Name = name
                };

                IRepository <Wind> repo = new WindRepository();
                repo.Update(wind);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #4
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                string name = collection.Get("Name");
                Wind   wind = new Wind()
                {
                    Name = name
                };

                IRepository <Wind> repo = new WindRepository();
                repo.Save(wind);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #5
0
        //
        // GET: /WindTemplate/Edit/5

        public ActionResult Edit(int id)
        {
            IRepository <Wind> repo = new WindRepository();

            return(View(repo.GetById(id)));
        }
예제 #6
0
        //
        // GET: /WindTemplate/

        public ActionResult Index()
        {
            IRepository <Models.Wind> repo = new WindRepository();

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