Ejemplo n.º 1
0
        public ActionResult PartyCreate(PartyModel model)
        {
            var service = new PartyService();
            var result  = service.CreateParty(model);

            return(RedirectToAction("GetAllParties", "Admin", null));
        }
Ejemplo n.º 2
0
        public void CanCreateParty()
        {
            FakePartyDb.Reset();
            var partyService = new PartyService();
            var createdParty = partyService.CreateParty("test");

            var party = partyService.GetParty(createdParty.Id);

            Assert.AreEqual(-1, party.HostId);
            Assert.AreEqual("test", party.Name);
        }
Ejemplo n.º 3
0
        public ActionResult Create(PartyCreate party)
        {
            if (ModelState.IsValid)
            {
                _userId       = Guid.Parse(User.Identity.GetUserId());
                _partyService = new PartyService(_userId);
                _partyService.CreateParty(party);
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId     = new SelectList(db.Categories, "CategoryId", "Name", party.CategoryId);
            ViewBag.NeighborhoodId = new SelectList(db.Neighborhoods, "NeighborhoodId", "Name", party.NeighborhoodId);
            ViewBag.LocationId     = new SelectList(db.Locations, "LocationId", "Name", party.LocationId);
            return(View());
        }
Ejemplo n.º 4
0
        public IActionResult CreateParty([FromBody] CreatePartyRequest request)
        {
            Authorize.TokenAgainstResource(HttpContext.User, request.CustomerId);

            if (request.PartySize <= 0)
            {
                throw new InvalidRequestException("PartySize must be greater than 0.");
            }

            var domainRequest = request.ToDomain();

            _partyService.CreateParty(domainRequest);

            return(Ok());
        }
Ejemplo n.º 5
0
        public void CanAddSongToParty()
        {
            FakePartyDb.Reset();
            var partyService = new PartyService();
            var createdParty = partyService.CreateParty("test");

            partyService.AddSongToParty(createdParty.Id, "abc");
            partyService.AddSongToParty(createdParty.Id, "def");
            partyService.AddSongToParty(createdParty.Id, "hij");

            var party = partyService.GetParty(createdParty.Id);

            Assert.AreEqual("abc", party.SongList[0]);
            Assert.AreEqual("def", party.SongList[1]);
            Assert.AreEqual("hij", party.SongList[2]);
        }