public ActionResult Delete(int TechCategoryID)
 {
     myHandler = new BusinessLogicHandler();
     tech = new TechCategory();
     tech.TechCategoryID = TechCategoryID;
     tech = myHandler.GetTechnologyType(TechCategoryID);
     return View(tech);
 }
        public ActionResult ByCategory(string name, int CategoryID)
        {
            #region Init

            BusinessLogicHandler myHandler = new BusinessLogicHandler();
            SearchViewModel model = new SearchViewModel();
            Technology helper = new Technology();
            #endregion

            #region Get Devices By Category

            if (name != null)
            {
                try
                {
                    model.GadgetResults = myHandler.CategoryDeviceSearch(name);
                    model.TCategory = new TechCategory();
                    helper = (Technology)model.GadgetResults.Take(1).FirstOrDefault();
                    model.TCategory = myHandler.GetTechnologyType(helper.TechCategoryID);
                }
                catch
                {
                    model.GadgetResults = myHandler.DevicesByCategory(CategoryID);//Replace
                    model.TCategory = new TechCategory();
                    model.TCategory = myHandler.GetTechnologyType(CategoryID);
                }

            }
            if (CategoryID != 0)
            {
                model.GadgetResults = myHandler.DevicesByCategory(CategoryID);//Replace
                model.TCategory = new TechCategory();
                model.TCategory = myHandler.GetTechnologyType(CategoryID);
            }

            #endregion

            return View(model);
        }
        public ActionResult Details(int ProductID)
        {
            #region Prep Utilities

            myHandler = new BusinessLogicHandler();
            AddNewTechViewModel model = new AddNewTechViewModel();

            #endregion

            #region Get Device Data

            model.techs = new Technology();
            model.techs = myHandler.GetTechnologyDetails(ProductID);

            #endregion

            #region Get Category Data

            model.Category = new TechCategory();
            model.Category = myHandler.GetTechnologyType(model.techs.TechCategoryID);

            #endregion

            #region Get Manufacturer Data

            model.mans = new Manufacturer();
            model.mans = myHandler.GetManufacturer(model.techs.ManufacturerID);

            #endregion

            return View(model);
        }
示例#4
0
        public ActionResult Product(int ProductID)
        {

            #region Prep Utilities
            myHandler = new BusinessLogicHandler();
            UnifiedViewModel model = new UnifiedViewModel();
            Author Author = new Author();
            #endregion

            #region Config Roles
            if(User.IsInRole("supplier"))
            {
                model.iSupplier = true;
            }
            #endregion

            #region Get the Data
            if (myHandler.CheckProductType(ProductID))
            {
                model.Book = new Book();
                model.Book = myHandler.GetBook(ProductID);
                model.BookCategory = new BookCategory();
                model.BookCategory = myHandler.GetBookCategory(model.Book.BookCategoryID);
                model.Publisher = new Publisher();
                model.Publisher = myHandler.GetPublisher(model.Book.PublisherID);
                IEnumerable<BookAuthor> authorsINbook = myHandler.GetBookAuthors(model.Book.BookID);
                model.Authors = new List<Author>();
                foreach(var item in authorsINbook)
                {
                    Author = myHandler.GetAuthorDetails(item.AuthorID);
                    model.Authors.Add(Author);
                }
            }
            else
            {
                model.Device = new Technology();
                model.Device = myHandler.GetTechnologyDetails(ProductID);
                model.Manufacturer = new Manufacturer();
                model.Manufacturer = myHandler.GetManufacturer(model.Device.ManufacturerID);
                model.Category = new TechCategory();
                model.Category = myHandler.GetTechnologyType(model.Device.TechCategoryID);
            }
            #endregion

            return View(model);
        }