Exemplo n.º 1
0
        public ActionResult Create(CategoryModel category)
        {
            try
            {
                _categoryDataAccess.AddCategory(category);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 private int AddUpdateCategory()
 {
     if (category != null && category.Id > 0)
     {
         category.Id           = categoryId;
         category.CategoryName = txtCategory.Text;
         category.IsActive     = chkActive.Checked;
         category.UpdatedBy    = userId;
         return(CategoryDataAccess.UpdateCategory(category));
     }
     else
     {
         var category = new CategoryDTO()
         {
             CategoryName = txtCategory.Text,
             IsActive     = chkActive.Checked,
             CreatedBy    = userId
         };
         return(CategoryDataAccess.AddCategory(category));
     }
 }