Class ItemController
In the Model-View-Controller pattern, the controller processes the input. In this case, it is all the input involving item operations. The most important method is the IndexAsync(String), which returns a list of items.
Inheritance
System.Object
Microsoft.AspNetCore.Mvc.ControllerBase
Microsoft.AspNetCore.Mvc.Controller
ItemController
Implements
Microsoft.AspNetCore.Mvc.Filters.IActionFilter
Microsoft.AspNetCore.Mvc.Filters.IAsyncActionFilter
Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata
System.IDisposable
Namespace: Scrapbook101core.Controllers
Assembly: Scrapbook101core.dll
Syntax
public class ItemController : Controller, IActionFilter, IAsyncActionFilter, IFilterMetadata, IDisposable
Constructors
| Improve this Doc View SourceItemController(IWebHostEnvironment)
Declaration
public ItemController(IWebHostEnvironment hostingEnvironment)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.AspNetCore.Hosting.IWebHostEnvironment | hostingEnvironment |
Methods
| Improve this Doc View SourceCreateAsync()
Declaration
[ActionName("Create")]
public async Task<ActionResult> CreateAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> |
CreateAsync(CombinedModel)
Declaration
[HttpPost]
[ActionName("Create")]
[ValidateAntiForgeryToken]
public async Task<ActionResult> CreateAsync(CombinedModel combinedModel)
Parameters
| Type | Name | Description |
|---|---|---|
| CombinedModel | combinedModel |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> |
DeleteAsync(String)
Declaration
[HttpGet]
[ActionName("Delete")]
public async Task<ActionResult> DeleteAsync(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> |
DeleteConfirmedAsync(String)
Declaration
[HttpPost]
[ActionName("Delete")]
public async Task<ActionResult> DeleteConfirmedAsync([Bind(new string[]{"Id"})] string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> |
DetailsAsync(String)
Declaration
[ActionName("Details")]
public async Task<ActionResult> DetailsAsync(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> |
EditAsync(CombinedModel)
Declaration
[HttpPost]
[ActionName("Edit")]
[ValidateAntiForgeryToken]
public async Task<ActionResult> EditAsync(CombinedModel combinedModel)
Parameters
| Type | Name | Description |
|---|---|---|
| CombinedModel | combinedModel |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> |
EditAsync(String)
Declaration
[HttpGet]
[ActionName("Edit")]
public async Task<ActionResult> EditAsync(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> |
IndexAsync(String)
Returns items based that contain the specified string. Note that for demonstration, the functionality is purposely limited. The string could also be found in description field. Similarly, more parameters can be added to expand the possibility of the searches.
Declaration
[ActionName("Index")]
public async Task<ActionResult> IndexAsync(string filter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filter | A string to find in titles. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> | A list of matching items |
Implements
Microsoft.AspNetCore.Mvc.Filters.IActionFilter
Microsoft.AspNetCore.Mvc.Filters.IAsyncActionFilter
Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata
System.IDisposable