public CoupleAddNewGuestVM CreateViewModelGuest() { CoupleAddNewGuestVM viewModel = new CoupleAddNewGuestVM { GuestStatus = guestStatus }; return(viewModel); }
public IActionResult AddGuest(CoupleAddNewGuestVM newGuestVM) { if (!ModelState.IsValid) { return(View(newGuestVM)); } coupleServices.AddNewGuest(newGuestVM); return(RedirectToAction(nameof(GuestList))); }
public IActionResult AddGuest(CoupleAddNewGuestVM newGuestVM, string saveAdd, string saveCancel) { if (!ModelState.IsValid) { return(View(newGuestVM)); } if (!string.IsNullOrEmpty(saveAdd)) { coupleServices.AddNewGuest(newGuestVM); return(RedirectToAction(nameof(AddGuest))); } else if (!string.IsNullOrEmpty(saveCancel)) { coupleServices.AddNewGuest(newGuestVM); return(RedirectToAction(nameof(GuestList))); } return(RedirectToAction(nameof(GuestList))); //redirect to something went wrong }
public void AddNewGuest(CoupleAddNewGuestVM newGuestVM) { Guest guest = new Guest() { Firstname = newGuestVM.Firstname, Lastname = newGuestVM.Lastname, Address = newGuestVM.Address, Email = newGuestVM.Email, InvitedBy = newGuestVM.InvitedBy, GuestTitle = newGuestVM.GuestTitle, WeddingCrewTitle = newGuestVM.WeddingCrewTitle, Rsvp = newGuestVM.SelectedRsvp, FoodPreference = newGuestVM.FoodPreference, GuestNote = newGuestVM.GuestNote, Userref = Userref() }; context.Guest.Add(guest); context.SaveChanges(); }
public void AddNewGuest(CoupleAddNewGuestVM newGuestVM) { var temp = Userref(); //Hämta parets id tilldela userref för att mappa gäst mot par Guest guest = new Guest() { Firstname = newGuestVM.Firstname, Lastname = newGuestVM.Lastname, Address = newGuestVM.Address, Email = newGuestVM.Email, InvitedBy = newGuestVM.InvitedBy, GuestTitle = newGuestVM.GuestTitle, WeddingCrewTitle = newGuestVM.WeddingCrewTitle, Rsvp = newGuestVM.Rsvp, FoodPreference = newGuestVM.FoodPreference, GuestNote = newGuestVM.GuestNote, Userref = temp }; context.Guest.Add(guest); context.SaveChanges(); }