Example #1
0
        public ActionResult Edit(Category model)
        {
            try
            {
                var category = this.CategoryRepository.Load(model.Id);
                category.Name = model.Name;
                category.Order = model.Order;
                this.CategoryRepository.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Example #2
0
 public ActionResult Create(Category model)
 {
     try
     {
         var category = new Category()
         {
             Name = model.Name,
             Order = model.Order,
             State = State.Nomal
         };
         this.CategoryRepository.Add(category);
         this.CategoryRepository.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }