Closed fasteddys closed 2 years ago
Your projects are nice, can we please get CRUD MVC, I have linked custom scaffolders
Describe the solution you'd like A clear and concise description of what you want to happen.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context
Customize the scaffolds https://github.com/ZeekoZhu/TextTemplatingCore https://docs.microsoft.com/en-us/archive/msdn-magazine/2014/june/asp-net-mvc-override-the-default-scaffold-templates
Link
<#@ template language="C#" HostSpecific="True" #> <#@ output extension=".cshtml" #> <#@ include file="Imports.include.t4" #> @model IEnumerable<#= "<" + ViewDataTypeName + ">" #> <# // The following chained if-statement outputs the file header code and markup for a partial view, a view using a layout page, or a regular view. if(IsPartialView) { #> <# } else if(IsLayoutPageSelected) { #> @{ ViewBag.Title = "<#= ViewName#>"; <# if (!String.IsNullOrEmpty(LayoutPageFile)) { #> Layout = "<#= LayoutPageFile#>"; <# } #> } <h2><#= ViewName#></h2> <# } else { #> @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title><#= ViewName #></title> </head> <body> <# PushIndent(" "); } #> <div class="row"> <div class="large-12 medium-12 small-12 columns"> <p> @Html.ActionLink("Create New", "Create") </p> <table class="table"> <tr> <# IEnumerable<PropertyMetadata> properties = ModelMetadata.Properties; foreach (PropertyMetadata property in properties) { if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey) { #> <# // We do not want to show any association properties for which there is // no associated foreign key. if (property.IsAssociation && GetRelatedModelMetadata(property) == null) { continue; } #> <th> @Html.DisplayNameFor(model => model.<#= GetValueExpression(property) #>) </th> <# } } #> <th></th> </tr> @foreach (var item in Model) { <tr> <# foreach (PropertyMetadata property in properties) { if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey) { #> <# // We do not want to show any association properties for which there is // no associated foreign key. if (property.IsAssociation && GetRelatedModelMetadata(property) == null) { continue; } #> <td> @Html.DisplayFor(modelItem => <#= "item." + GetValueExpression(property) #>) </td> <# } } string pkName = GetPrimaryKeyName(); if (pkName != null) { #> <td> @Html.ActionLink("Edit", "Edit", new { id=item.<#= pkName #> }) | @Html.ActionLink("Details", "Details", new { id=item.<#= pkName #> }) | @Html.ActionLink("Delete", "Delete", new { id=item.<#= pkName #> }) </td> <# } else { #> <td> @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) | @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) | @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ }) </td> <# } #> </tr> } </table> </div> </div> <# // The following code closes the tag used in the case of a view using a layout page and the body and html tags in the case of a regular view page #> <# if(!IsPartialView && !IsLayoutPageSelected) { ClearIndent(); #> </body> </html> <# } #> <#@ include file="ModelMetadataFunctions.cs.include.t4" #>
I created code generator for this solution https://github.com/neozhu/CleanArchitectureCodeGenerator
Can you also consider MVC, so we can use WEB API
Your projects are nice, can we please get CRUD MVC, I have linked custom scaffolders
Describe the solution you'd like A clear and concise description of what you want to happen.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context
Customize the scaffolds https://github.com/ZeekoZhu/TextTemplatingCore https://docs.microsoft.com/en-us/archive/msdn-magazine/2014/june/asp-net-mvc-override-the-default-scaffold-templates
Link