public async Task <ActionResult> Buy(Guid ebookId) { using (var db = new EbookManagerDbContext()) { var catalogRepository = new CatalogRepository(db); var userId = ClaimsPrincipal.Current.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value; await catalogRepository.BuyEbookAsync(userId, ebookId); TempData["Success"] = "Votre achat a été pris en compte !"; return(RedirectToAction("Index", "MySpace")); } }