private void sendconfirmation(Esubscribtion sub) { EmailContent cnt = new EmailContent(); cnt.Subject = $"Welcome {sub.FirstName} {sub.LastName}"; cnt.To = sub.Email; cnt.message = $"Welcome {sub.FirstName} {sub.LastName}! You have successfully subscribed! You will recieve a notification every time the admin posts a new game. Sorry, no way to unsubscribe yet..:P"; EmailManager mngr = new EmailManager(); mngr.SendNotification(cnt); }
public int AddEsubscribtion(Esubscribtion sub) { SqlConnection Con = new SqlConnection(_connectionstring); SqlCommand cmd = Con.CreateCommand(); cmd.CommandText = @"insert into Enotification Values(@FN,@LN,@email) select SCOPE_IDENTITY()"; cmd.Parameters.AddWithValue("@Fn", sub.FirstName); cmd.Parameters.AddWithValue("@LN", sub.LastName); cmd.Parameters.AddWithValue("@Email", sub.Email); Con.Open(); int SI = (int)(decimal)cmd.ExecuteScalar(); sendconfirmation(sub); return SI; }