public async Task <IActionResult> Add(Reservation reservation) { using var client = new ApiClient(); User user; client.Token = Request.Cookies["token"]; user = await client.GetUserAsync(); if (user == null) { return(RedirectToAction("Login", "Authentication")); } reservation.UserId = user.Id; var result = await client.AddReservationAsync(reservation); if (result != null) { return(RedirectToAction("Details", new { id = result.Id })); } return(RedirectToAction("Details", "Reservations", new { id = reservation.AdvertisementId })); }