public IActionResult AddOrUpdate(int eventId) { if (ModelState.IsValid) { var associatedEvent = _eventService.GetById(eventId); try { var added = _guestService.AddNewGuest(new Guest( Guest.FirstName, Guest.LastName, Guest.Patronymic, Guest.Email) { Id = Guest.Id, Comment = Guest.Comment }, associatedEvent); return(RedirectToAction("ManageGuests", "Events", associatedEvent != null ? new { id = associatedEvent.Id } : null)); } catch (GuestIsAlreadyExistsException ex) { ViewBag.ValidationErrorMessage = ex.Message; return(View(Guest)); } catch (MaxGuestsForEventException mgex) { ViewBag.ValidationErrorMessage = mgex.Message; return(View(Guest)); } } return(View(Guest)); }