Add action for adding new bundles
This commit is contained in:
parent
b20759f205
commit
dc58f242fa
@ -32,5 +32,16 @@ namespace MyDarling.Controllers
|
||||
}
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
public ActionResult Add()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public ActionResult Add(UnderwearBundle b)
|
||||
{
|
||||
repository.Add(b);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
33
Views/Bundles/Add.cshtml
Normal file
33
Views/Bundles/Add.cshtml
Normal file
@ -0,0 +1,33 @@
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@model MyDarling.Models.UnderwearBundle
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>New bundle</title>
|
||||
<link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<container>
|
||||
<form asp-action="Add" method="post" class="m-2">
|
||||
<div asp-validation-summary="All"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Name" class="form-label">Name:</label>
|
||||
<input asp-for="Name" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Description" class="form-label">Descrition:</label>
|
||||
<input asp-for="Description" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Price" class="form-label">Price:</label>
|
||||
<input asp-for="Price" class="form-control" />
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary mt-3">Submit</button>
|
||||
</form>
|
||||
</container>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -34,6 +34,7 @@
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<a asp-action="Add">Add bundle</a>
|
||||
</container>
|
||||
</body>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user