Skip to content

Commit

Permalink
Functional version
Browse files Browse the repository at this point in the history
  • Loading branch information
victorrar committed Dec 23, 2020
1 parent 48a37b1 commit 213a516
Show file tree
Hide file tree
Showing 54 changed files with 2,359 additions and 454 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
/_ReSharper.Caches/
/TRPZ_PrintService/uploads/
34 changes: 12 additions & 22 deletions .idea/.idea.TRPZ_PrintService/.idea/contentModel.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

331 changes: 85 additions & 246 deletions .idea/.idea.TRPZ_PrintService/.idea/workspace.xml

Large diffs are not rendered by default.

50 changes: 11 additions & 39 deletions TRPZ_PrintService/Areas/Identity/Pages/Account/Login.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,30 @@
ViewData["Title"] = "Log in";
}

<h1>@ViewData["Title"]</h1>

<div class="row">
<div class="col-md-4">

<div class="col-md-4 ">
</div>
<div class="col-md-4 ">
<h1>@ViewData["Title"]</h1>
<section>
<form id="account" method="post">
<h4>Use a local account to log in.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<input asp-for="Input.Email" class="form-control"/>
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.Password"></label>
<input asp-for="Input.Password" class="form-control" />
<input asp-for="Input.Password" class="form-control"/>
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-group">
<div class="checkbox">
<label asp-for="Input.RememberMe">
<input asp-for="Input.RememberMe" />
<input asp-for="Input.RememberMe"/>
@Html.DisplayNameFor(m => m.Input.RememberMe)
</label>
</div>
Expand All @@ -48,38 +50,8 @@
</form>
</section>
</div>
<div class="col-md-6 col-md-offset-2">
<section>
<h4>Use another service to log in.</h4>
<hr />
@{
if ((Model.ExternalLogins?.Count ?? 0) == 0)
{
<div>
<p>
There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
for details on setting up this ASP.NET application to support logging in via external services.
</p>
</div>
}
else
{
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
<div>
<p>
@foreach (var provider in Model.ExternalLogins)
{
<button type="submit" class="btn btn-primary" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
}
</p>
</div>
</form>
}
}
</section>
</div>
</div>

@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
<partial name="_ValidationScriptsPartial"/>
}
23 changes: 20 additions & 3 deletions TRPZ_PrintService/Data/Order.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using TRPZ_PrintService.Areas.Identity.Data;

namespace TRPZ_PrintService.Data
Expand All @@ -9,15 +11,30 @@ public class Order
public int OrderId { get; set; }
public DateTime Timestamp { get; set; }
public TimeSpan TotalPrintTime { get; set; }
public bool IsSent { get; set; }
public bool IsConfirmed { get; set; }
public bool IsFinished { get; set; }
public OrderStatus Status { get; set; }

public TRPZ_PrintServiceUser Client { get; set; }
public PromoCode PromoCode { get; set; }

public List<ModelInOrder> Models { get; set; }

[NotMapped]
public int PriceTotal
{
get { return Models.Sum(x => x.PriceTotal) + Models.Sum(x => x.PostProcessing.Price); }
}



public enum OrderStatus
{
NotSent,
Sent,
Confirmed,
Finished,
Cancelled,

}
public Order()
{
Models = new List<ModelInOrder>();
Expand Down
4 changes: 4 additions & 0 deletions TRPZ_PrintService/Data/TRPZ_PrintServiceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasOne(o => o.ModelSettings)
.WithOne(settings => settings.ModelInOrder)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<Order>()
.HasOne(o => o.Client)
.WithMany(settings => settings.Orders)
.OnDelete(DeleteBehavior.Cascade);
}
}
}
2 changes: 2 additions & 0 deletions TRPZ_PrintService/Data/TRPZ_PrintServiceUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using TRPZ_PrintService.Data;

namespace TRPZ_PrintService.Areas.Identity.Data
{
Expand All @@ -11,5 +12,6 @@ public class TRPZ_PrintServiceUser : IdentityUser
{
[PersonalData] public string FirstName { get; set; }
[PersonalData] public string LastName { get; set; }
public IList<Order> Orders {get; set; }
}
}
Loading

0 comments on commit 213a516

Please sign in to comment.