Commit e5300c1f authored by adnan's avatar adnan

applying css style

parent e713de21
......@@ -32,15 +32,16 @@ namespace SIX.Web.Controllers
[HttpPost]
public IActionResult Add(Models.Location.AddNewLocationModel location)
{
if (!ModelState.IsValid)
return new BadRequestResult();
_locationService.Add(new Core.Location.Location
if (ModelState.IsValid)
{
Id = Guid.NewGuid(),
Name = location.Name,
CreatedDate = DateTime.UtcNow
_locationService.Add(new Core.Location.Location
{
Id = Guid.NewGuid(),
Name = location.Name,
CreatedDate = DateTime.UtcNow
});
});
}
return RedirectToAction("Index");
}
......
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
......@@ -10,7 +11,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using SIX.Infrastructure.Repositories;
using SIX.Service.Location;
......@@ -62,6 +63,8 @@ namespace SIX.Web
app.UseHttpsRedirection();
app.UseStaticFiles();
// This will add "Libs" as another valid static content location
app.UseCookiePolicy();
app.UseMvc(routes =>
......
@model SIX.Web.Models.Location.AddNewLocationModel
<h1>NEW LOCATION</h1>
<h4>NEW LOCATION</h4>
@using (Html.BeginForm("Add", "Form", FormMethod.Post))
@using (Html.BeginForm("Add", "Location", FormMethod.Post))
{
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name)
<div class="form-group">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
@Html.ValidationMessage("Name")
<input type="submit" class="button" value="OK" />
</div>
<button type="submit" class="btn btn-primary">Submit</button>
}
@section scripts
{
<partial name="_ValidationScriptsPartial" />
}
\ No newline at end of file
@model SIX.Web.Models.Location.EditNewLocationModel
<h1>EDIT LOCATION</h1>
<h4>EDIT LOCATION</h4>
@using (Html.BeginForm("Edit", "Location", FormMethod.Post))
{
@Html.HiddenFor(m => m.Id)
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name)
<div class="form-group">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
@Html.ValidationMessage("Name")
</div>
<button type="submit" class="btn btn-primary">Update</button>
}
@section scripts
{
<partial name="_ValidationScriptsPartial" />
<input type="submit" class="button" value="OK" />
}
@model SIX.Web.Models.Location.LocationPageViewModel
<h1>LOCATIONS</h1>
<h4>LOCATIONS</h4>
<table border="1" width="100%">
<thead align="center">
<a asp-controller="Location" asp-action="Add" class="btn btn-primary">Add New Location</a>
<table class="table">
<thead>
<tr>
<td>Nama</td>
<td>Action</td>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Action</th>
</tr>
</thead>
@foreach (var location in Model.Locations)
{
<tr>
<td>@location.Name</td>
<td><a asp-controller="Location" asp-action="Edit" asp-route-id="@location.Id">Edit </a> | <a asp-controller="Location" asp-action="View" asp-route-id="@location.Id">View</a></td>
</tr>
}
<tbody>
@{ int i = 0; }
@foreach (var location in Model.Locations)
{
<tr>
<th scope="row">@(++i)</th>
<td>@location.Name</td>
<td><a asp-controller="Location" asp-action="Edit" asp-route-id="@location.Id">Edit </a> | <a asp-controller="Location" asp-action="View" asp-route-id="@location.Id">View</a></td>
</tr>
}
</tbody>
</table>
<li>
<a asp-controller="Location" asp-action="Add">Add New Location</a>
</li>
@model SIX.Web.Models.Location.EditNewLocationModel
<h1>VIEW LOCATION</h1>
<h4>VIEW LOCATION</h4>
@using (Html.BeginForm("Delete", "Location", FormMethod.Post))
{
@Html.HiddenFor(m => m.Id)
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name, new { @readonly = "readonly" })
<input type="submit" class="button" value="DELETE" />
<div class="form-group">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name, new { @class = "form-control", @readonly = "readonly" })
</div>
<button type="submit" class="btn btn-primary">Delete</button>
}
<environment include="Development">
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
<script type="text/javascript">var settings = {
validClass: "is-valid",
errorClass: "is-invalid"
};
$.validator.setDefaults(settings);
$.validator.unobtrusive.options = settings;</script>
</environment>
<environment exclude="Development">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.min.js"
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
asp-fallback-test="window.jQuery && window.jQuery.validator"
crossorigin="anonymous"
integrity="sha256-F6h55Qw6sweK+t7SiOJX+2bpSAa3b/fnlrVCJvmEj1A=">
</script>
integrity="sha256-F6h55Qw6sweK+t7SiOJX+2bpSAa3b/fnlrVCJvmEj1A="></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js"
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
crossorigin="anonymous"
integrity="sha256-9GycpJnliUjJDVDqP0UEu/bsm9U+3dnQUH8+3W10vkY=">
</script>
integrity="sha256-9GycpJnliUjJDVDqP0UEu/bsm9U+3dnQUH8+3W10vkY="></script>
<script type="text/javascript">var settings = {
validClass: "is-valid",
errorClass: "is-invalid"
};
$.validator.setDefaults(settings);
$.validator.unobtrusive.options = settings;</script>
</environment>
......@@ -36,6 +36,12 @@ button.accept-policy {
line-height: inherit;
}
span.field-validation-error {
color: red;
font-size: smaller;
}
/* Sticky footer styles
-------------------------------------------------- */
html {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment