public ActionResult Index(InviteCommand command) { //TODO: validate try { var loggedInMember = _members.FindLoggedInMember(); var invite = new Invitation(); invite.FullName = command.FullName; invite.Email = command.Email; invite.LinkedIn = command.LinkedIn; invite.GitHub = command.GitHub; invite.Testimonial = command.Testimonial; invite.VouchedBy = loggedInMember.Id; _session.Store(invite); loggedInMember.AddInvitation(invite.Id); _session.SaveChanges(); //TODO: publish event _email.SendInvitationToGroup(invite, loggedInMember.UserName); invite.Pending(); _session.SaveChanges(); //in the short run, this will give us a heads up if the mandril send is failing return RedirectToAction("Ok"); } catch (Exception) { ModelState.AddModelError("", "error"); return View(command); } }
public void Setup() { int suffix = (new Random()).Next(10000); var account = CloudStorageAccount.DevelopmentStorageAccount; this.notificationContainer = new AzureBlobContainer <NotificationStatus>(account, ConfigurationConstants.NotificationsContainerName + "test" + suffix, true); this.userContainer = new AzureBlobContainer <UserProfile>(account, ConfigurationConstants.UsersContainerName + "test" + suffix, true); this.userSessionContainer = new AzureBlobContainer <UserSession>(account, ConfigurationConstants.UserSessionsContainerName + "test" + suffix, true); this.friendsContainer = new AzureBlobContainer <Friends>(account, ConfigurationConstants.FriendsContainerName + "test" + suffix, true); this.notificationRepository = new NotificationRepository(this.notificationContainer); this.userRepository = new UserRepository(this.userContainer, this.userSessionContainer, this.friendsContainer); this.userRepository.Initialize(); this.command = new InviteCommand(this.notificationRepository, this.userRepository); }
public void Setup() { int suffix = (new Random()).Next(10000); var account = CloudStorageAccount.DevelopmentStorageAccount; this.notificationContainer = new AzureBlobContainer<NotificationStatus>(account, ConfigurationConstants.NotificationsContainerName + "test" + suffix, true); this.userContainer = new AzureBlobContainer<UserProfile>(account, ConfigurationConstants.UsersContainerName + "test" + suffix, true); this.userSessionContainer = new AzureBlobContainer<UserSession>(account, ConfigurationConstants.UserSessionsContainerName + "test" + suffix, true); this.friendsContainer = new AzureBlobContainer<Friends>(account, ConfigurationConstants.FriendsContainerName + "test" + suffix, true); this.notificationRepository = new NotificationRepository(this.notificationContainer); this.userRepository = new UserRepository(this.userContainer, this.userSessionContainer, this.friendsContainer); this.userRepository.Initialize(); this.command = new InviteCommand(this.notificationRepository, this.userRepository); }
public ActionResult Index() { var model = new InviteCommand(); return View(model); }
private void RelayInviteCommand(object sender, InviteCommand e) { string msg = string.Format("[{0}] * {1} invited {2}", e.Channel, Bot.IRC.Nickname, e.Nick); ProcessRelay(e.Channel, RelayType.Invite, msg); }
public async Task <IActionResult> InviteAsync([FromBody] InviteCommand inviteCommand) { var id = await _mediator.Send(inviteCommand); return(Ok(id)); }