public async Task <IActionResult> AllPurchasedCarnets(PurchasedCarnetsViewModel model) { model.TimeCarnets = await _carnetService.GetPurchasedCarnets(_timeCarnetCategoryName); model.QuantityCarnets = await _carnetService.GetPurchasedCarnets(_quantityCarnetCategoryName); return(View("PurchasedCarnets", model)); }
public async Task <IActionResult> PurchasedCarnets(PurchasedCarnetsViewModel model) { var currentUserEmail = HttpContext.User.Identity.Name; model.TimeCarnets = await _carnetService.GetPurchasedCarnets(currentUserEmail, _timeCarnetCategoryName); model.QuantityCarnets = await _carnetService.GetPurchasedCarnets(currentUserEmail, _quantityCarnetCategoryName); return(View("PurchasedCarnets", model)); }
public async Task <IActionResult> PurchasedCarnets(PurchasedCarnetsViewModel model, int carnetId) //Activates carnet { var userEmail = HttpContext.User.Identity.Name; var isAnyActive = await _carnetService.IsAnyActive(userEmail); if (isAnyActive) { ModelState.AddModelError("", "Posiadasz już jeden aktywny bilet czasowy, nie można posiadać 2 aktywnych karnetów jednocześnie"); model.TimeCarnets = await _carnetService.GetPurchasedCarnets(userEmail, _timeCarnetCategoryName); model.QuantityCarnets = await _carnetService.GetPurchasedCarnets(userEmail, _quantityCarnetCategoryName); return(View(model)); } await _carnetService.ActivateCarnet(carnetId); return(View("ActivateCarnetConfirmation")); }