using Contracts.ViewModels; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using System.Diagnostics.Eventing.Reader; using WebApp.Helpers; namespace WebApp.Pages { [Authorize(Roles = Roles.User)] public class CartModel : PageModel { public PurchaseViewModel purchaseModel = null; public Dictionary Products { get; set; } public void OnGet(Guid id, int count) { if (purchaseModel == null) { purchaseModel = APIClient.GetRequest($"Purchase/Create/{this.GetUserId()}"); APIClient.GetRequest($"Purchase/AddProducts?purchaseId={purchaseModel.Id}?productId={id}?count={count}"); } purchaseModel = APIClient.GetRequest($"Purchase/Get/"); Products = APIClient.GetRequest>($"Purchase/GetProducts?id={purchaseModel.Id}"); } public IActionResult OnPostAsync() { return RedirectToAction(""); } } }