//POST public ActionResult AddDeveloper(FormCollection collection) { var initiative = _initiativeBusiness.GetInitiative(Guid.Parse(collection["InitiativeId"])); if (collection["InviteEmail"].Equals(string.Empty)) { TempData["AddDeveloperError"] = "Enter an email adress"; return(RedirectToAction("Member", new { initiativeId = collection["InitiativeId"] })); } if (!new EmailAddressAttribute().IsValid(collection["InviteEmail"])) { TempData["AddDeveloperError"] = "Email adress is wrongly formatted"; return(RedirectToAction("Member", new { initiativeId = collection["InitiativeId"] })); } if (initiative.DeveloperRoles.Any(x => x.DeveloperName == collection["InviteEmail"])) { TempData["AddDeveloperError"] = "This developer is already a member of the initiative"; return(RedirectToAction("Member", new { initiativeId = collection["InitiativeId"] })); } initiative.AddDeveloperRolesInvitation(collection["InviteEmail"]); _initiativeBusiness.UpdateInitiative(initiative); _initiativeBusiness.ConfirmInvitation(initiative.Id, collection["InviteEmail"]); return(RedirectToAction("Member", new { initiativeId = collection["InitiativeId"] })); }
public ActionResult Accept(string id) { Guid initiativeId; IInitiative initiative; if (Guid.TryParse(id, out initiativeId)) { initiative = _initiativeBusiness.GetInitiative(initiativeId); } else { initiative = _initiativeBusiness.GetInitiativeByInviteCode(id); if (initiative == null) { ViewBag.AcceptError = "The invitation has been removed, or perhaps the invite code is wrong."; return(View()); } } _initiativeBusiness.ConfirmInvitation(initiative.Id, _accountRepository.FindById(User.Identity.GetUserId()).Email); return(View((object)initiative.Name)); }