private void ViewEditData() { category = CategoryDataAccess.GetCategoryById(categoryId); if (category != null) { txtCategory.Text = category.CategoryName; chkActive.Checked = category.IsActive; } }
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)); } }
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))); }