public IActionResult OnGet(int?visitid) { if (visitid == null) { return(RedirectToPage("/NotFound")); } Visit = visitRepository.GetVisitById(visitid.Value); Visit.User = userManager.Users.SingleOrDefault(); return(Page()); }
public IActionResult OnGet() { Products = shopItemData.Products(SearchItem); Services = shopItemData.Services(SearchItem); Visit = new Core.Visit(); if (Visit == null) { return(RedirectToPage("/NotFound")); } var list = userManager.Users.ToList().Select(x => new { Id = x.Id, Name = $"{x.FirstName} {x.LastName}" }); Users = new SelectList(list, "Id", "Name"); return(Page()); }
public IActionResult OnPost(int?visitid) { if (ModelState.IsValid) { if (visitid.HasValue) { Visit = visitRepository.GetVisitById(visitid.Value); } Visit = visitRepository.Update(Visit); visitRepository.Commit(); return(RedirectToPage("./ShopList")); } Message = Visit.UserId == null ? "No customer selected!" : $"Total pay: {calc.TotalPerVisit(Visit)}"; return(Page()); }
public double TotalPerVisit(Core.Visit visit) { return(calc.TotalPerVisit(visit)); }