aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/add-feature-template.sh30
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/add-feature-template.sh b/tools/add-feature-template.sh
index d283563..b96d288 100755
--- a/tools/add-feature-template.sh
+++ b/tools/add-feature-template.sh
@@ -219,11 +219,11 @@ mkdir -p $subdir
models=("" "Create" "Edit")
for model in "${models[@]}"
do
-cat > $subdir/$model${feature_name}ViewModel.cs<< EOF
+cat > $subdir/$model${feature_name}WebModel.cs<< EOF
using System;
namespace $project_name.Web.Models.$feature_name {
- public class $model${feature_name}ViewModel {$(
+ public class $model${feature_name}WebModel {$(
if [ ! -z $model ]; then
echo -e "\n\t\tpublic Guid Id { get; set; }"
fi
@@ -258,7 +258,7 @@ subdir="$dir/Views/$feature_name"
mkdir -p $subdir
cat > $subdir/Index.cshtml<< EOF
-@model ${feature_name}ViewModel
+@model ${feature_name}WebModel
@{
ViewData["Title"] = "$feature_name";
}
@@ -273,7 +273,7 @@ done
EOF
cat > $subdir/Create.cshtml<< EOF
-@model Create${feature_name}ViewModel
+@model Create${feature_name}WebModel
@{
ViewData["Title"] = "Creating a new $feature_name";
}
@@ -291,7 +291,7 @@ done
EOF
cat > $subdir/Edit.cshtml<< EOF
-@model Edit${feature_name}ViewModel
+@model Edit${feature_name}WebModel
@{
ViewData["Title"] = "Editing $feature_name";
}
@@ -363,8 +363,8 @@ namespace $project_name.Web.Controllers
if (serviceModel == null)
return RedirectToAction("Index", "Home");
- ${feature_name}ViewModel viewModel = this._autoMapper.Map<${feature_name}ViewModel>(serviceModel);
- return View(viewModel);
+ ${feature_name}WebModel webModel = this._autoMapper.Map<${feature_name}WebModel>(serviceModel);
+ return View(webModel);
}
[HttpGet]
@@ -374,9 +374,9 @@ namespace $project_name.Web.Controllers
}
[HttpPost]
- public async Task<IActionResult> Create(Create${feature_name}ViewModel viewModel)
+ public async Task<IActionResult> Create(Create${feature_name}WebModel webModel)
{
- Create${feature_name}ServiceModel create${feature_name}ServiceModel = this._autoMapper.Map<Create${feature_name}ServiceModel>(viewModel);
+ Create${feature_name}ServiceModel create${feature_name}ServiceModel = this._autoMapper.Map<Create${feature_name}ServiceModel>(webModel);
bool result = await this._service.CreateAsync(create${feature_name}ServiceModel);
@@ -394,19 +394,19 @@ namespace $project_name.Web.Controllers
if (serviceModel == null)
return RedirectToAction("Index", "Home");
- Edit${feature_name}ViewModel edit${feature_name}ViewModel = this._autoMapper.Map<Edit${feature_name}ViewModel>(serviceModel);
- return View(edit${feature_name}ViewModel);
+ Edit${feature_name}WebModel edit${feature_name}WebModel = this._autoMapper.Map<Edit${feature_name}WebModel>(serviceModel);
+ return View(edit${feature_name}WebModel);
}
[HttpPost]
- public async Task<IActionResult> Edit(Edit${feature_name}ViewModel viewModel)
+ public async Task<IActionResult> Edit(Edit${feature_name}WebModel webModel)
{
- Edit${feature_name}ServiceModel edit${feature_name}ServiceModel = this._autoMapper.Map<Edit${feature_name}ServiceModel>(viewModel);
+ Edit${feature_name}ServiceModel edit${feature_name}ServiceModel = this._autoMapper.Map<Edit${feature_name}ServiceModel>(webModel);
bool result = await this._service.EditAsync(edit${feature_name}ServiceModel);
if (result)
- return RedirectToAction("Index", new { id = viewModel.Id.ToString() });
+ return RedirectToAction("Index", new { id = webModel.Id.ToString() });
else
return RedirectToAction("Index", "Home");
}
@@ -438,7 +438,7 @@ EOF
subdir="${dir}/Configurations"
-mappings=("${feature_name}ServiceModel, ${feature_name}ViewModel" "Create${feature_name}ViewModel, Create${feature_name}ServiceModel" "${feature_name}ServiceModel, Edit${feature_name}ViewModel" "Edit${feature_name}ViewModel, Edit${feature_name}ServiceModel")
+mappings=("${feature_name}ServiceModel, ${feature_name}WebModel" "Create${feature_name}WebModel, Create${feature_name}ServiceModel" "${feature_name}ServiceModel, Edit${feature_name}WebModel" "Edit${feature_name}WebModel, Edit${feature_name}ServiceModel")
cat > $subdir/Controller${feature_name}Mappings.cs<< EOF
using AutoMapper;
using $project_name.Services.Models.$feature_name;