public void SendUserWelcomeEmail(User user) { MailMessage = new MailMessage(_cmsEntries.VideoClubEmailAddress,user.Email); MailMessage.Subject = _cmsEntries.WelcomeEmailSubject; MailMessage.Body = _cmsEntries.WelcomeEmailBody + user.Name; Console.WriteLine(MailMessage.ToString()); }
public void RegisterUser(User user) { if (IsUserUnderaged(user)) { return; } if (NotAllFieldsPresent(user)) { return; } else { Users.Add(user); _emailServices.SendUserWelcomeEmail(user); } }
private Boolean NotAllFieldsPresent(User user) { if (string.IsNullOrEmpty(user.Name) || string.IsNullOrEmpty(user.Email)) { return true; } else { return false; } }
private Boolean IsUserUnderaged(User user) { return user.Age < 18 || user.Age == 0; }
public void UserAddsTitleToWishlist(User user, string titleName) { WishlistCannotBeNull(user); user.Wishlist.Add(titleName.ToLower()); }
public User GetUser(User user) { return Users.Find(x => x.Equals(user)); }
public bool CheckUserWishlistForTitle(User user, string titleName) { return user.Wishlist.Contains(titleName.ToLower()); }
public void AddLoyaltyPointsToUser(User user, int loyaltyPoints) { user.LoyaltyPoints += loyaltyPoints; }
private void WishlistCannotBeNull(User user) { if (user.Wishlist == null) { user.Wishlist = new List<string>(); } }