protected void referUser_Click(object sender, EventArgs e) { message.Visible = true; if (FudgeUser != null) { var user = db.Users.SingleOrDefault(u => u.Email == email.Text.Trim()); if (user != null) { message.InnerHtml = String.Format("{0} is already a member on fudge.", Html.LinkToProfile(user.UserId)); } else { //send the invitation email if (FudgeUser.Invite(email.Text)) { message.Attributes["class"] = "fudge_message"; message.InnerText = "Invitation sent successfully"; } else { message.InnerText = "There was an error sending invite, make sure the email is valid"; } } } else { message.InnerText = "You must be logged in to invite a user"; } email.Text = String.Empty; }
protected void Invite_Click(object sender, EventArgs e) { var badEmails = new List <string>(); foreach (var address in emails.Text.Split(',')) { //send the invitation email if (!FudgeUser.Invite(address)) { badEmails.Add(address); } } message.Visible = true; if (badEmails.Count > 0) { message.InnerText = "There was an error sending invite, to the following emails " + badEmails.Join(","); } else { message.Attributes["class"] = "fudge_message"; message.InnerText = "Invitation sent successfully"; } emails.Text = String.Empty; }