public void CreateFundraiser() { var fundraiser = _fundraiserRepository.Create("test fundraiser", testCampaign.Id, FundraiserType.Individual, "test"); Assert.IsTrue(fundraiser.Name == "test fundraiser", "name matches"); Assert.IsTrue(fundraiser.Id != null && fundraiser.Id.ToString() != "00000000-0000-0000-0000-000000000000", "id is set"); Assert.IsTrue(fundraiser.CampaignId == testCampaign.Id, "campaign id is set"); //Assert.IsFalse(campaign.IsActive, "'test campaign' was created but is not active"); Console.WriteLine("fundraiser.Id: " + fundraiser.Id); var fundraiser2 = _fundraiserRepository.FindById(fundraiser.Id); Assert.IsInstanceOfType(fundraiser2, typeof(Fundraiser)); Assert.IsTrue(fundraiser.Name == fundraiser2.Name); Assert.IsTrue(fundraiser2.CampaignId == testCampaign.Id); Console.WriteLine("type: " + fundraiser2.FundraiserType); }
public ActionResult Create(FundraiserFormViewModel model) { if (User.Identity.IsAuthenticated) { var fundraiser = _fundraiserRepository.Create(model.Name, model.CampaignId, FundraiserType.Individual, User.Identity.GetUserId()); return(RedirectToAction("Index", new { id = fundraiser.Id })); } else { return(RedirectToAction("Create")); } }
protected override Guid HandleCore(Create request) { var fundraiser = _fundraiserRepository.Create(request.Name, request.CampaignId, FundraiserType.Individual, request.UserId); return(fundraiser.Id); }