Example #1
0
        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));
        }
Example #2
0
        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());
        }
Example #6
0
        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"));
        }
Example #7
0
        public ActionResult GuestArrivedListDetails()
        {
            var       FoundUserId = User.Identity.GetUserId();
            GuestList guestList   = db.GuestList.Where(c => c.ApplicationUserId == FoundUserId).FirstOrDefault();

            return(View(guestList));
        }
Example #8
0
        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"));
        }
Example #9
0
 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()}].");
     }
 }
Example #10
0
        public ActionResult DeleteConfirmed(int id)
        {
            GuestList guestList = db.GuestLists.Find(id);

            db.GuestLists.Remove(guestList);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #11
0
 public void Pack(BinaryWriter writer)
 {
     writer.Write((uint)0x10000002); // Unused value
     writer.Write(Bitmask);
     writer.Write(MonarchID);
     GuestList.Pack(writer);
     RoomMateList.Pack(writer);
 }
Example #12
0
        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"));
        }
Example #13
0
        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"));
        }
Example #14
0
        public void InsertJson(string jsonText)
        {
            List <Guest> newList = JsonConvert.DeserializeObject <List <Guest> >(jsonText);

            foreach (var eventItem in newList)
            {
                GuestList.Add(eventItem);
            }
        }
Example #15
0
 //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);
     }
 }
Example #16
0
        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));
            }
        }
Example #17
0
 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));
 }
Example #18
0
        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));
        }
Example #19
0
        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));
        }
Example #21
0
        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"));
        }
Example #23
0
        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"));
        }
Example #24
0
        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"));
        }
Example #26
0
        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));
        }
Example #28
0
        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"));
        }
Example #30
0
        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();
        }