public PeekWishesViewModel(IRepository <Wishes> repository, Guests currentGuest) { Repository = repository; Collection = Repository.Collection.Where(wish => wish.GuestID == currentGuest.GuestID).ToList(); CurrentGuest = currentGuest; Repository.ModelCollectionChanged += () => { Collection = Repository.Collection.Where(wish => wish.GuestID == currentGuest.GuestID).ToList(); RaisePropertyChanged("Collection"); }; }
public ActionResult Sign_Up(Guests g) { if (ModelState.IsValid) { return(View("Thank_you", g)); } else { return(View()); } }
public ViewResult Inviteform(Guests guests) { if (ModelState.IsValid) { return(View("thanks", guests)); } else { return(View()); } }
private void AddGuest(object o) { Guests.Add(new Guest { Name = Name, Company = Company }); Name = string.Empty; Company = string.Empty; }
//Method for add guest public void AddGuest(string name, string text) { Guests.Add( new Guest { Name = name, GuestText = text, Date = DateTime.Now }); SaveChanges(); }
public async Task <IActionResult> Create([Bind("ActorID,ActorFullName,ActorNotes")] Guests guests) { if (ModelState.IsValid) { _context.Add(guests); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(guests)); }
public async Task <IActionResult> Create([Bind("GuestId,GuestTile,GuestForenames,GuestSurnames,GuestsDOB,GuestAddressStreet,GuestAddressTown,GuestAddressSCountry,GuestAddressPostalCode,GuestContactPhone")] Guests guests) { if (ModelState.IsValid) { _context.Add(guests); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(guests)); }
[HttpPost] //Capturar los datos de la forma y enviarlos //Al hacer un submit, se da el POST y se ejecuta la clase public ViewResult Reservar(Guests gr) { if (ModelState.IsValid) //ModelState.IsValid, se va a modelo de Datos y ahi hace las validaciones correspondientes. { return(View("Gracias", gr)); } else { return(View()); } }
public Guest AddGuest(string name, string email, string phoneNumber) { if (Guests.Any(g => g.Name == name)) { throw new ArgumentException("Guest cannot be added twice."); } Guest guest = new Guest(name, email, phoneNumber); Guests.Add(guest); return(guest); }
public ViewResult RsvpForm(Guests guests) { if (ModelState.IsValid) { return(View("Thanks", guests)); } else { return(View()); } }
public void FilterGuests() { DisplayedGuests = new ObservableCollection <Guest>(Guests.Where(g => (g.FirstName != null && g.FirstName.ToLower().Contains(FilterGuestString)) || (g.LastName != null && g.LastName.ToLower().Contains(FilterGuestString)) || (g.PhoneNumber != null && g.PhoneNumber.ToLower().Contains(FilterGuestString)) || (g.PostalCode != null && g.PostalCode.ToLower().Contains(FilterGuestString)) || (g.EmailAdress != null && g.EmailAdress.ToLower().Contains(FilterGuestString)) || (g.City != null && g.City.ToLower().Contains(FilterGuestString)) || (g.Country != null && g.Country.ToLower().Contains(FilterGuestString)))); }
public async Task <IActionResult> Create([Bind("GuestId,GuestFirstName,GuestLastName,GuestFullName,GuestEmail,GuestPhone,OrganizationId,GuestAddress,GuestCity,GuestState,GuestZip")] Guests guests) { if (ModelState.IsValid) { _context.Add(guests); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrganizationId"] = new SelectList(_context.Organizations, "OrganizationId", "OrganizationName", guests.OrganizationId); return(View(guests)); }
/// <summary> /// /// </summary> private void btnAddGuest(object sender, RoutedEventArgs e) { CreateGuestWindow newGuestWindow = new CreateGuestWindow(); newGuestWindow.ShowDialog(); if (newGuestWindow.DialogResult.Value) { Guests.Add(newGuestWindow.Guest); lbGuests.ItemsSource = null; lbGuests.ItemsSource = Guests; } }
private void BindNewGuest(SqlInt32 newGuestId) { BindGuests(); Guests guest = new Guests(); guest.Guest_ID = newGuestId; DataTable table = guest.SelectOne(); grid.DataSource = table; grid.DataBind(); hidNewGuestId.Value = newGuestId.ToString(); }
public Guests CreateGuest(Guests guest) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } _context.Guest.Add(guest); _context.SaveChanges(); return(guest); }
private void button1_Click(object sender, EventArgs e) { try { Guests g = new Guests(); dgvGuestlist.DataSource = g.ListGuest(); } catch (Exception ex) { throw new Exception(ex.Message); } }
private void CheckIfGuestsNeedToGoHome() { List <Sim> simsToGoHome = new List <Sim>(); foreach (Sim sim in Guests) { bool flag = VisitSituation.IsGuestAllowedToStayOver(sim); if (sim.MoodManager.IsInStrongNegativeMood || (!flag && (sim.BuffManager.HasElement(BuffNames.Tired) || sim.BuffManager.HasElement(BuffNames.Exhausted)))) { AddSimToGoHome(sim, simsToGoHome); } if (sim.SimDescription.ChildOrBelow && (SimClock.Hours24 >= GetParams().HourAtWhichChildrenGoHome)) { AddSimToGoHome(sim, simsToGoHome); foreach (Genealogy genealogy in sim.Genealogy.Parents) { SimDescription simDescription = genealogy.SimDescription; if (simDescription != null) { Sim createdSim = simDescription.CreatedSim; if ((createdSim != null) && Guests.Contains(createdSim)) { AddSimToGoHome(createdSim, simsToGoHome); } } } } float delta = sim.MoodManager.MoodValue * GetParams().MoodToTimeMod; DateAndTime time; if (!flag && mTimeForSimToLeave.TryGetValue(sim.ObjectId, out time)) { time = SimClock.Add(time, TimeUnit.Minutes, delta); if (time.CompareTo(SimClock.CurrentTime()) < 0x0) { AddSimToGoHome(sim, simsToGoHome); } else { mTimeForSimToLeave[sim.ObjectId] = time; } } } foreach (Sim sim3 in simsToGoHome) { if (sim3.LotCurrent == Lot) { MakeGuestGoHome(sim3); } } }
public IActionResult Unrsvp(int weddingId) { if (HttpContext.Session.GetInt32("UserId") == null) { return(RedirectToAction("Index")); } int UserId = HttpContext.Session.GetInt32("UserId") ?? default(int); Guests RsvpToRemove = dbContext.guests.FirstOrDefault(x => x.WeddingId == weddingId && x.UserId == UserId); dbContext.guests.Remove(RsvpToRemove); dbContext.SaveChanges(); return(RedirectToAction("Weddings")); }
public IActionResult RSVP(int id) { int? ThisUserId = HttpContext.Session.GetInt32("UserId"); User ThisUser = dbContext.user.FirstOrDefault(u => u.UserId == ThisUserId); Wedding ThisWedding = dbContext.wedding.FirstOrDefault(w => w.WeddingId == id); Guests NewGuest = new Guests(); NewGuest.UserId = ThisUser.UserId; NewGuest.WeddingId = ThisWedding.WeddingId; dbContext.guests.Add(NewGuest); dbContext.SaveChanges(); return(RedirectToAction("Dashboard")); }
public async Task UpdateAsync(RsvpRepository repository) { var existingInvitation = await repository.GetInvitationByIdAsync(EventId, Id); // Iterate over the existing guests so that we only change the acceptance. // Don't allow new guests to be added or old guests to be removed. existingInvitation.Guests.ForEach(guest => { var matchingGuest = Guests.FirstOrDefault(x => x.Id == guest.Id); guest.Accepted = matchingGuest.Accepted; }); await repository.UpdateInvitationAsync(existingInvitation); }
public IActionResult NewGuests([FromBody] Guests guests) { try { unit.Guests.AddGuests(guests); unit.Complete(); return(Ok("New guests added!")); } catch (Exception ex) { return(BadRequest("Failed to add guests, " + ex.ToString())); } }
// GET: Guests/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Guests guests = db.Guests.Find(id); if (guests == null) { return(HttpNotFound()); } return(View(guests)); }
private void AddGuest(object o) { // Save state _undoMementos.Push(Guests.Memento); Guests.Add(new Guest { Name = Name, Company = Company }); Name = string.Empty; Company = string.Empty; }
public void Put(int id, [FromBody] Guests guest) { if (guest == null) { return; } if (!db.Rooms.Any(x => x.RoomId == guest.RoomId)) { return; } db.Update(guest); db.SaveChanges(); }
public static GuestModel ToCustomerModel(this Guests customer) { return(new GuestModel { FirstName = customer.FirstName, Email = customer.Email, PostalCode = customer.PostalCode, LastName = customer.LastName, CityCode = customer.CityCode, GuestId = customer.GuestId, RoomId = customer.RoomId, TenantName = customer.TenantName }); }
public void StartAddingGuest() { var guest = new Guest(); GroupBoxName = "New Guest"; var g = new AddGuestViewModel(); g.Initialize(new EditGuestCommand(guest), () => { StartAddingGuest(); }, guest, () => { Guests.Add(guest); StartAddingGuest(); }); CurrentGuest = g; }
public CardDefault(Binary b) { this.b = b; InitializeComponent(); Account acc = MapPage._g; if (acc is Guests) { Guests g = acc as Guests; if (!DBActions.hasBooked(g, b.PRODUCT)) { btn.Text = "RESERVERA"; } } lbl.Text = b.PRODUCT.Description; btn.Clicked += async(s, e) => { if (loading) { return; } if (MapPage._g is Admins) { if (await DBActions.Check(MapPage._g as Admins, MapPage.mapPage)) { return; } } loading = true; await DBActions.LoadProducts(); await DBActions.LoadUsers(); var prds = DBActions.GetProductById(b.PRODUCT.ID); if (prds != null && prds.Quantity > 0 && DBActions.GetAdminById(prds.AdminID) != null) { MapPage.mapPage.OpenProduct(b); } else { App.Send("Info", "Produkten finns inte längre!", "Ok"); if (DBActions.GetAdminById(prds.AdminID) == null) { await DBActions.CheckProducts(); } MapPage.mapPage.ReloadAll(); } loading = false; }; }
public void RemoveGuest(Guest guest) { var del = Reservations.Where(i => i.Value.Contains(guest.ID)); foreach (var r in del) { Reservations[r.Key].Remove(guest.ID); } ReservationsTrasaction(); Guests.Remove(guest); GuestsTrasaction(); }
private void Guest_StateChanged() { if (Guests.Any()) { Guests.Clear(); } var guests = _searchGuestService.SearchGuest(Guest.FirstName, Guest.LastName, Guest.Phone); if (guests.Any()) { Guests = new ObservableCollection <Guest>(guests); } }
internal Person GetUser(string username) { var id = IsGuest(username); if (id < 0 && Users.ContainsKey(username)) { return(Users[username]); } if (id >= 0 && Guests.ContainsKey(id)) { return(Guests[id]); } return(null); }