public HttpResponse AddUserToTrip(string tripId) { if (!IsUserLoggedIn()) { return(Redirect("/Home/Index")); } var userId = User; if (tripService.IsUserInTrip(userId, tripId)) { return(Redirect($"/Trips/Details?tripId={tripId}")); } tripService.AddUserToTrip(userId, tripId); return(Redirect("/Home/Index")); }
public Response AddUserToTrip(string tripId) { try { tripService.AddUserToTrip(tripId, User.Id); } catch (ArgumentException aex) { return(View(new List <ErrorViewModel>() { new ErrorViewModel(aex.Message) }, "/Error")); } catch (Exception) { return(View(new List <ErrorViewModel>() { new ErrorViewModel("Unexpected Error") }, "/Error")); } return(Redirect("/Trips/All")); }