// GET: Households/Create //[Authorize(Roles = ApplicationRoleName.ADMINISTRATOR)] public ActionResult Create() { Household household = new Household(); household.HeadOfHousehold = UserRolesHelper.GetUserById(User.Identity.GetUserId());; return(View(household)); }
public void InviteUserToJoinHousehold(string userId, int householdId) { string senderEmailAddress = UserRolesHelper.GetUserById(User.Identity.GetUserId()).Email; string inviteeEmailAddress = UserRolesHelper.GetUserById(userId).Email; string invitationUrl = Url.Action(ActionName.INVITATION_ACCEPTANCE, ControllerName.HOUSEHOLDS, new { householdId = householdId, userId = userId, inviteeEmailAddress = inviteeEmailAddress }, protocol: Request.Url.Scheme); UserSpecificIdentityMessage notificationMessage = new UserSpecificIdentityMessage { Origin = senderEmailAddress, Destination = inviteeEmailAddress, Subject = "You've been invited to join a household budget", Body = "<a href=" + invitationUrl + ">Click here if you wish to accept the invitation</a>" }; EmailService emailService = new EmailService(); emailService.SendAsSpecificUserAsync(notificationMessage); }