public async Task <IActionResult> Edit(int id, [Bind("GuestListID,FanID,EventID,Going,Arrived")] GuestList guestList) { if (id != guestList.GuestListID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(guestList); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GuestListExists(guestList.GuestListID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EventID"] = new SelectList(_context.Events, "EventID", "EventID", guestList.EventID); ViewData["FanID"] = new SelectList(_context.Fans, "FanID", "FanID", guestList.FanID); return(View(guestList)); }
public ActionResult UnCheck(Guid guestID, Guid EventID) { GuestList GuestClass = new GuestList(); var list = GuestClass.UnCheckInGuest(guestID); return(RedirectToAction("Edit", new { eventID = EventID })); }
public void MappingHelper_ConvertPartyToGuestList() { // Arrange var partyId = new Guid(); var expected = new GuestList { Id = partyId, Guests = new[] { new Guest { GuestId = 0, Name = "Test Guest", Email = "*****@*****.**" } } }; var subject = new Party { Id = partyId, Guests = expected.Guests, CreationDate = DateTime.Now }; // Act var result = subject.ToGuestList(); // Assert Assert.AreEqual(expected.Id, result.Id); Assert.AreEqual(expected.Guests, result.Guests); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FullName,GuestStatus,Side,Email,Phone,Address")] GuestList guestList) { if (id != guestList.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(guestList); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GuestListExists(guestList.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(guestList)); }
public async Task <IActionResult> PutGuestList([FromRoute] int id, [FromBody] GuestList guestList) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != guestList.Id) { return(BadRequest()); } _context.Entry(guestList).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GuestListExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult Rsvp(int id) { int?Id = HttpContext.Session.GetInt32("Id"); if (Id == null) { return(RedirectToAction("Index", "Login")); } User user = _context.Users.SingleOrDefault(u => u.UserId == Id); Event wedding = _context.Events.SingleOrDefault(e => e.EventId == id); GuestList check = _context.GuestList.SingleOrDefault(g => g.AttendeeId == user.UserId && g.EventId == wedding.EventId); if (check != null || wedding.CreatorId == user.UserId) { return(RedirectToAction("Index")); } GuestList guest = new GuestList { Attendee = user, Event = wedding }; _context.GuestList.Add(guest); _context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult GuestArrivedListDetails() { var FoundUserId = User.Identity.GetUserId(); GuestList guestList = db.GuestList.Where(c => c.ApplicationUserId == FoundUserId).FirstOrDefault(); return(View(guestList)); }
public IActionResult Unrvsp(int id) { GuestList RetrievedListItem = context.GuestLists.SingleOrDefault(list => list.WeddingId == id && list.GuestId == (int)HttpContext.Session.GetInt32("UserId")); context.GuestLists.Remove(RetrievedListItem); context.SaveChanges(); return(RedirectToAction("Dashboard")); }
private void Validate() { if (GuestList.Count() != GuestNumber.Value) { throw new DomainException( $"Guest number [{GuestNumber.Value}] does not match with number of guests on list [{GuestList.Count()}]."); } }
public ActionResult DeleteConfirmed(int id) { GuestList guestList = db.GuestLists.Find(id); db.GuestLists.Remove(guestList); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Pack(BinaryWriter writer) { writer.Write((uint)0x10000002); // Unused value writer.Write(Bitmask); writer.Write(MonarchID); GuestList.Pack(writer); RoomMateList.Pack(writer); }
public IActionResult UnRSVP(int Id) { int? loggedInId = HttpContext.Session.GetInt32("CurrUser"); GuestList retrievedConnection = _context.Guests.SingleOrDefault(g => g.GuestId == loggedInId && g.WeddingId == Id); _context.Guests.Remove(retrievedConnection); _context.SaveChanges(); return(RedirectToAction("Dashboard")); }
public IActionResult Un_RSVP(int wId) { int useId = HttpContext.Session.GetInt32("userId").Value; GuestList guest = _context.users_weddings.SingleOrDefault(rev => (rev.UserId == useId && rev.WeddingId == wId)); _context.users_weddings.Remove(guest); _context.SaveChanges(); return(RedirectToAction("Dashboard")); }
public void InsertJson(string jsonText) { List <Guest> newList = JsonConvert.DeserializeObject <List <Guest> >(jsonText); foreach (var eventItem in newList) { GuestList.Add(eventItem); } }
//Opens park allowing people to come visit //Async to allow them to join a little at a time public async void OpenPark() { ParkIsOpen = true; for (int i = 0; i < 100; i++) { GuestList.Add(new Guest(this)); await Task.Delay(1); } }
public void SetGroups(ClientGroups groups) { this.groups = groups; GuestList.SetGroup(groups.GetGroup(0)); for (int i = 1; i < groups.Count(); i++) { AddGroup(groups.GetGroup(i)); } }
public ActionResult Edit([Bind(Include = "GuestId,Name,Email,Phone,WillAttend")] GuestList guestList) { if (ModelState.IsValid) { db.Entry(guestList).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(guestList)); }
public ActionResult Create([Bind(Include = "GuestId,Name,Email,Phone,WillAttend")] GuestList guestList) { if (ModelState.IsValid) { db.GuestLists.Add(guestList); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(guestList)); }
public IActionResult Rvsp(int id) { GuestList newListItem = new GuestList { GuestId = (int)HttpContext.Session.GetInt32("UserId"), WeddingId = id }; context.GuestLists.Add(newListItem); context.SaveChanges(); return(RedirectToAction("Dashboard")); }
public async Task <IActionResult> Create([Bind("Id,FullName,GuestStatus,Side,Email,Phone,Address")] GuestList guestList) { if (ModelState.IsValid) { _context.Add(guestList); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(guestList)); }
public IActionResult Leave(int ActividadId) { int? session = HttpContext.Session.GetInt32("loggedinUser"); GuestList guestToRemove = dbContext.GuestLists.Where(i => i.ActividadId == ActividadId).FirstOrDefault(i => i.UserId == (int)session); dbContext.Remove(guestToRemove); dbContext.SaveChanges(); return(Redirect("/home")); }
public IActionResult LeaveActivity(int id) { if (HttpContext.Session.GetInt32("UserId") == null) { return(View("Index")); } GuestList RetrievedListItem = context.GuestLists.SingleOrDefault(list => list.ActivityId == id && list.GuestId == (int)HttpContext.Session.GetInt32("UserId")); context.GuestLists.Remove(RetrievedListItem); context.SaveChanges(); return(RedirectToAction("Home")); }
public IActionResult UNRSVP(int WeddingId) { int? session = HttpContext.Session.GetInt32("loggedinUser"); GuestList guestToRemove = dbContext.GuestLists.Where(i => i.WeddingId == WeddingId).FirstOrDefault(i => i.UserId == (int)session); dbContext.Remove(guestToRemove); dbContext.SaveChanges(); return(Redirect("/dashboard")); }
public IActionResult RSVP(int Id) { int? loggedInId = HttpContext.Session.GetInt32("CurrUser"); GuestList NewConnection = new GuestList { GuestId = (int)loggedInId, WeddingId = Id }; _context.Guests.Add(NewConnection); _context.SaveChanges(); return(RedirectToAction("Dashboard")); }
public IActionResult UnRSVP(int wedding_id) { GuestList remove = _context.GuestLists .SingleOrDefault(Guest => Guest.WeddingId == wedding_id && Guest.UserId == (int)HttpContext.Session.GetInt32("id")); _context.Remove(remove); _context.SaveChanges(); return(RedirectToAction("Index", "Wedding")); }
public IActionResult RSVP(int WedId) { GuestList newGuest = new GuestList { UserId = HttpContext.Session.GetInt32("userId").Value, WeddingId = WedId }; _context.users_weddings.Add(newGuest); _context.SaveChanges(); return(RedirectToAction("Dashboard")); }
public async Task <IActionResult> PostGuestList([FromBody] GuestList guestList) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.GuestLists.Add(guestList); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGuestList", new { id = guestList.Id }, guestList)); }
public ActionResult CreateGuestArrivedList([Bind(Include = "GuestListID,FullName,Arrived")] GuestList guestList) { if (ModelState.IsValid) { var userId = User.Identity.GetUserId(); guestList.ApplicationUserId = userId; db.GuestList.Add(guestList); db.SaveChanges(); return(RedirectToAction("GuestArrivedListDetails", new { id = guestList.GuestListID })); } return(View(guestList)); }
public IActionResult RSVP(int wedding_id) { GuestList newGuest = new GuestList { UserId = (int)HttpContext.Session.GetInt32("id"), WeddingId = wedding_id }; _context.Add(newGuest); _context.SaveChanges(); return(RedirectToAction("Index", "Wedding")); }
public IActionResult RemoveGuest(int weddingId) { int?activeId = HttpContext.Session.GetInt32("activeUser"); if (activeId != null) { GuestList canceledGuest = _context.guestlist.SingleOrDefault(g => g.eventid == weddingId && g.guestid == (int)activeId); _context.guestlist.Remove(canceledGuest); _context.SaveChanges(); return(RedirectToAction("Dashboard")); } return(RedirectToAction("Index", "Login")); }
public ActionResult BringGuest(GuestList g) { User u = db.Users.Find(int.Parse(Session["UserID"].ToString())); Customer c = db.Customers.Where(x => x.EMail == u.EMail).FirstOrDefault(); GuestList current = db.GuestLists.Where(x => x.CustomerID == c.ID).FirstOrDefault(); if (current != null) { DateTime d = current.Date ?? DateTime.Now; d = d.AddDays(6); if (d <= DateTime.Now) { g.CustomerID = c.ID; db.GuestLists.Add(g); db.SaveChanges(); TempData["Success"] = g.GuestFirstName + " " + g.GuestLastName + " is now your guest."; ModelState.Clear(); return View(); } else { TempData["Error"] = "You can only bring one guest per week. You brought " + current.Customer.FirstName + " " + current.Customer.LastName + " this week. You can bring your guest back again " + d; return View(); } } else if (current == null) { g.CustomerID = c.ID; db.GuestLists.Add(g); db.SaveChanges(); TempData["Success"] = g.Customer.FirstName + " " + g.Customer.LastName + " is now your guest."; ModelState.Clear(); return View(); } return View(); }