Esempio n. 1
0
        public ActionResult Index(int?id)
        {
            var items_results = new List <Item>();

            try
            {
                if (id != null)
                {
                    if (id == 0)
                    {
                        items_results    = item_Service.GetItems();
                        ViewBag.Category = "All Categoties";
                    }
                    else
                    {
                        items_results    = item_Service.GetItems().Where(x => x.Category.CategoryId == (int)id).ToList();
                        ViewBag.Category = department_Service.GetCategory(id).CategoryName;
                    }
                }
                else
                {
                    items_results      = item_Service.GetItems();
                    ViewBag.Department = "All Departments";
                }
            }
            catch (Exception ex) { }
            return(View(items_results));
        }
Esempio n. 2
0
 /// <summary>
 /// Retrieves the specified category
 /// </summary>
 /// <param name="id">The id of the category to retrieve</param>
 /// <returns>The requested category</returns>
 public Category GetCategory(int id)
 {
     try
     {
         CategoryEntity categoryEntity = _categoryLogic.GetCategory(id);
         return(TranslateCategoryEntityToCategoryContractData(categoryEntity));
     }
     catch (ArgumentOutOfRangeException ex)
     {
         throw new FaultException <CategoryFault>(new CategoryFault(ex.Message), FaultSource);
     }
 }
Esempio n. 3
0
 public ActionResult Details(int?id)
 {
     if (id == null)
     {
         return(RedirectToAction("Bad_Request", "Error"));
     }
     if (categoryLogic.GetCategory(id) != null)
     {
         return(View(categoryLogic.GetCategory(id)));
     }
     else
     {
         return(RedirectToAction("Not_Found", "Error"));
     }
 }