private void ViewEditData()
 {
     category = CategoryDataAccess.GetCategoryById(categoryId);
     if (category != null)
     {
         txtCategory.Text  = category.CategoryName;
         chkActive.Checked = category.IsActive;
     }
 }
Пример #2
0
        public ActionResult Create(EventModel newEvent, int categoryId)
        {
            newEvent.Category = _categoryDataAccess.GetCategoryById(categoryId);

            try
            {
                var newId = _eventDataAccess.CreateEvent(newEvent);
                return(RedirectToAction("View", "Event", new { id = newId }));
            }
            catch
            {
                ViewBag.Error =
                    "There was an error creating the event, please review the fields below and correct any mistakes.";
                var categories = _categoryDataAccess.GetCategories();
                ViewBag.Categories = categories;
                return(View(newEvent));
            }
        }
Пример #3
0
        public ActionResult Edit(int id)
        {
            var category = _categoryDataAccess.GetCategoryById(id);

            return(View(category));
        }
        public ActionResult Delete(int id)
        {
            CategoryDataAccess cda = new CategoryDataAccess();

            return(View(cda.GetCategoryById(id)));
        }