Skip to content

Commit

Permalink
added category create and edit functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mobeendev committed Jul 5, 2024
1 parent 0e3acc1 commit 49b2caa
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 50 deletions.
54 changes: 30 additions & 24 deletions Areas/Admin/Views/Category/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,37 @@
ViewData["Title"] = "Create";
}

<h1>Create</h1>
<div class="container-fluid">

<h4>New Category</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="CategoryName" class="control-label"></label>
<input asp-for="CategoryName" class="form-control" />
<span asp-validation-for="CategoryName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Create new Category</h1>
<a asp-areas="Admin" asp-controller="Category" asp-action="Index"
class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-back"></i> Back</a>
</div>


<div class="row justify-content-center">
<div class="col-md-4 ml-10 py-3 position-relative">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="CategoryName" class="control-label"></label>
<input asp-for="CategoryName" class="form-control" />
<span asp-validation-for="CategoryName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>

<div class="row">
<div class="ml-auto">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</div>
</form>
</div>
</div>
</div>

<div>
<a asp-action="Index" asp-areas="Admin" asp-controller="Category">Back to List</a>
</div>
56 changes: 31 additions & 25 deletions Areas/Admin/Views/Category/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,39 @@
ViewData["Title"] = "Edit";
}

<h1>Edit</h1>
<div class="container-fluid">

<h4>Update Category</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="CategoryId" />
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Edit Category</h1>
<a asp-areas="Admin" asp-controller="Category" asp-action="Index"
class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-back"></i> Back</a>
</div>


<div class="row justify-content-center">
<div class="col-md-4 ml-10 py-3 position-relative">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="CategoryId" />

<div class="form-group">
<label asp-for="CategoryName" class="control-label"></label>
<input asp-for="CategoryName" class="form-control" />
<span asp-validation-for="CategoryName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
<div class="form-group">
<label asp-for="CategoryName" class="control-label"></label>
<input asp-for="CategoryName" class="form-control" />
<span asp-validation-for="CategoryName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>

<div class="row">
<div class="ml-auto">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</div>
</form>
</div>
</div>
</div>

<div>
<a asp-action="Index" asp-areas="Admin" asp-controller="Category">Back to List</a>
</div>
2 changes: 1 addition & 1 deletion Areas/Admin/Views/Category/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h6 class="m-0 font-weight-bold text-primary">Existing Categories List</h6>

<div class="row">
<div class="col-sm-2 mb-3 mb-sm-0">
<div class="ml-auto">
<a asp-areas="Admin" asp-controller="Category" asp-action="Create" class="form-control btn btn-secondary">Add New</a>
</div>
</div>
Expand Down
Binary file added BethanysPieShop.db-shm
Binary file not shown.
Empty file added BethanysPieShop.db-wal
Empty file.

0 comments on commit 49b2caa

Please sign in to comment.