-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathIndex.cshtml.cs
More file actions
32 lines (28 loc) · 1.01 KB
/
Index.cshtml.cs
File metadata and controls
32 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.RazorPages;
using OrderApp.Models;
using OrderApp.Services;
namespace OrderApp.Pages
{
public class IndexModel : PageModel
{
public Order Order;
public List<(Product product, int quantity)> OrderDetails;
public int ShippingPercent { get; private set; }
public decimal Total { get; private set; }
public (string Message, int Step) ShippingStatus { get; private set; }
private IOrdersService _ordersService;
public IndexModel(IOrdersService ordersService)
{
_ordersService = ordersService;
}
public void OnGet()
{
Order = _ordersService.GetOrder();
OrderDetails = _ordersService.GetOrderDetails(Order.OrderId);
ShippingStatus = _ordersService.GetShippingStatus(Order.OrderId);
ShippingPercent = (ShippingStatus.Step * 20) + 20;
Total = _ordersService.GetOrderTotal(Order.OrderId);
}
}
}