Database Reference
In-Depth Information
{
db.Entry(categoryValue).State = System.Data.EntityState.Deleted;
db.SaveChanges();
return RedirectToAction("Index");
}
}
catch
{
return View();
}
}
}
}
Create five views for all of the actions as Create, Delete, Details, Edit, and Index in
CategoryController
. You can
add a view, as shown in Figure
4-9
, by right-clicking on any operation in the controller and selecting AddView. A new
view will be added into the Views
➤
Category folder, as shown in Figure
4-9
.
Figure 4-9.
Adding a view using an action method in the controller