Example #1
0
        public ActionResult EditCategory(int id, FormCollection f)
        {
            OnBalance.Domain.Entities.Category model = null;
            try
            {
                var db = new ProductRepository();
                model = _productRepository.GetCategory(id);
                if (model == null)
                {
                    ErrorFormat("User #{0} tries to update non-existing category #{1}!", User.Identity.Name, id);
                    return(RedirectToAction("notfound", "help"));
                }

                UpdateModel(model);
                db.SubmitChanges();
                return(RedirectToAction("editcategory", new { id = id }));
            } catch (Exception ex)
            {
                Error(string.Concat("Error updating category #", id), ex);
                ModelState.AddModelError("", ex.Message);
            }

            return(View(model));
        }
Example #2
0
 public CategoryListItem(OnBalance.Domain.Entities.Category model)
 {
 }