diff options
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/add-feature-template.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/add-feature-template.sh b/tools/add-feature-template.sh index 3a8695b..51f1990 100755 --- a/tools/add-feature-template.sh +++ b/tools/add-feature-template.sh @@ -274,6 +274,13 @@ done <input type="submit" value="Create"> </form> + +@if (Model != null) +{ + <p class="form-error"> + Couldn't create ${feature_name}! + </p> +} EOF cat > $subdir/Edit.cshtml<< EOF @@ -294,6 +301,13 @@ done <input type="submit" value="Edit"> </form> + +@if (Model != null) +{ + <p class="form-error"> + Couldn't edit ${feature_name}! + </p> +} EOF cat > $subdir/Delete.cshtml<< EOF @@ -373,6 +387,9 @@ namespace $project_name.Web.Controllers [HttpPost] public async Task<IActionResult> Create(Create${feature_name}WebModel webModel) { + if (!ModelState.IsValid) + return View(editUserViewModel); + ${feature_name}ServiceModel serviceModel = this._autoMapper.Map<${feature_name}ServiceModel>(webModel); bool result = await this._service.CreateAsync(serviceModel); @@ -395,6 +412,9 @@ namespace $project_name.Web.Controllers [HttpPost] public async Task<IActionResult> Edit(Edit${feature_name}WebModel webModel) { + if (!ModelState.IsValid) + return View(webModel); + ${feature_name}ServiceModel serviceModel = this._autoMapper.Map<${feature_name}ServiceModel>(webModel); bool result = await this._service.EditAsync(serviceModel); |
