Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverQueenArrowTheBest committed Oct 22, 2022
2 parents ec9664b + fa55c7c commit 4028eaa
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
13 changes: 8 additions & 5 deletions NationalLibrary/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ public IActionResult router()

public IActionResult addUser()
{
Console.WriteLine("test");
if (userFinal == null || userFinal.Type.ToLower() == "user")
return RedirectToAction("Error");
{
return RedirectToAction("Error");
}

return View();
}

Expand Down Expand Up @@ -396,7 +398,6 @@ public IActionResult insertUser(UserFinalView user)
{
try
{

if (string.IsNullOrEmpty(user.FCRelatedTO) && (DateTime.Now - user.BirthDate).TotalDays > 6570)
{
DataQueries.InsertUser(user.FiscalCode, "User", user.Name, user.Surname, user.MobilePhone, user.BirthDate, user.City, user.Street,
Expand All @@ -414,14 +415,16 @@ public IActionResult insertUser(UserFinalView user)
}
else
{
return RedirectToAction("addUser");
return RedirectToAction("addUser");
}
return RedirectToAction("dashboard", userFinal);
}
}
catch (Exception ex)
{
return Error();
ViewData["Message"] = "Il Tutore non esiste, devi prima crearlo";
return View("addUser");
//return Error();
}
}
//public static UserFinalView getUserByFiscalCode(string FiscalCode, LibraryContext ctx)
Expand Down
23 changes: 23 additions & 0 deletions NationalLibrary/Views/Home/addUser.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
<input minlength="16" maxlength="16" placeholder="Codice Fiscale" asp-for="@Model.FCRelatedTO" type="text" name="FCRelatedTO">
</div>
</div>
@if (ViewData["Message"] != null)
{
<div id="popuptutordiv"
style="border: none;
display: none;
color: red;
font-size: 13px;">
@ViewData["Message"]
</div>
<br />
}
<div class="inputContainer">
<label for="name">Nome</label>
<div>
Expand Down Expand Up @@ -158,4 +169,16 @@
</div>
</div>
</main>

<script type="text/javascript">
window.onload = async () => {
var tutorpopup = document.getElementById("popuptutordiv");
if (tutorpopup.innerHTML != '') {
tutorpopup.style.display = 'block';
await setTimeout(() => {
tutorpopup.style.display = 'none';
}, 5000);
}
}
</script>
</body>
2 changes: 1 addition & 1 deletion NationalLibrary/Views/Home/userDashboard.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
<span class="placeholder">Inserisci Una Richiesta In Particolare</span>
</label>
</div>
<button class="special-button" type="submit">Invia Richiesta</button>
<button class="special-button" type="submit" style="margin-top: 15px; margin-left:60px">Invia Richiesta</button>
</form>
</div>
</div>
Expand Down
9 changes: 4 additions & 5 deletions NationalLibrary/wwwroot/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,11 @@ incoming {
}

.bookToAdd {
display: grid;
grid-template-rows: 10% auto auto;
align-items: center;
grid-row-gap: 30%;
display: flex;
justify-content: center;
margin-top: 30px;
flex-direction: column;
padding: 0 15px;
margin-top: 110px;
width: 100%;
}

Expand Down

0 comments on commit 4028eaa

Please sign in to comment.