aboutsummaryrefslogtreecommitdiff
path: root/tools/add-feature-template.sh
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-13 15:30:43 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-13 15:30:43 +0300
commit1bf0c255644e18dea50018a7d425ddf7c220ac91 (patch)
tree8ccfcc5953c60c51ce535523177f12a57bd95885 /tools/add-feature-template.sh
parentdb5be8683405cbe6c76443a90e1f6cb93dde2346 (diff)
downloadit-kariera-exam-template-1bf0c255644e18dea50018a7d425ddf7c220ac91.tar
it-kariera-exam-template-1bf0c255644e18dea50018a7d425ddf7c220ac91.tar.gz
it-kariera-exam-template-1bf0c255644e18dea50018a7d425ddf7c220ac91.zip
Improved redirecttoaction and removed bad checks in add feature script
Diffstat (limited to 'tools/add-feature-template.sh')
-rwxr-xr-xtools/add-feature-template.sh18
1 files changed, 6 insertions, 12 deletions
diff --git a/tools/add-feature-template.sh b/tools/add-feature-template.sh
index dd3d764..3a8695b 100755
--- a/tools/add-feature-template.sh
+++ b/tools/add-feature-template.sh
@@ -359,9 +359,6 @@ namespace $project_name.Web.Controllers
{
${feature_name}ServiceModel serviceModel = await this._service.GetByIdAsync(Guid.Parse(id));
- if (serviceModel == null)
- return RedirectToAction("Index", "Home");
-
${feature_name}WebModel webModel = this._autoMapper.Map<${feature_name}WebModel>(serviceModel);
return View(webModel);
}
@@ -381,9 +378,9 @@ namespace $project_name.Web.Controllers
bool result = await this._service.CreateAsync(serviceModel);
if (result)
- return RedirectToAction("Profile", "Account");
+ return RedirectToAction("Index");
else
- return RedirectToAction("Index", "Home");
+ return RedirectToAction("Create");
}
[HttpGet]
@@ -391,9 +388,6 @@ namespace $project_name.Web.Controllers
{
${feature_name}ServiceModel serviceModel = await this._service.GetByIdAsync(Guid.Parse(id));
- if (serviceModel == null)
- return RedirectToAction("Index", "Home");
-
Edit${feature_name}WebModel edit${feature_name}WebModel = this._autoMapper.Map<Edit${feature_name}WebModel>(serviceModel);
return View(edit${feature_name}WebModel);
}
@@ -406,9 +400,9 @@ namespace $project_name.Web.Controllers
bool result = await this._service.EditAsync(serviceModel);
if (result)
- return RedirectToAction("Index", new { id = webModel.Id.ToString() });
+ return RedirectToAction("Details", new { id = webModel.Id.ToString() });
else
- return RedirectToAction("Index", "Home");
+ return RedirectToAction("Edit", new { id = webModel.Id.ToString() });
}
[HttpGet]
@@ -423,9 +417,9 @@ namespace $project_name.Web.Controllers
bool result = await this._service.DeleteAsync(Guid.Parse(id));
if (result)
- return RedirectToAction("Index", "Home");
+ return RedirectToAction("Index");
else
- return RedirectToAction("Index", new { id = id });
+ return RedirectToAction("Delete", new { id = id });
}
}
}