示例#1
0
        //Basic Hashcode and Equals methods
        public override int GetHashCode()
        {
            int hash = 5;

            hash = 83 * hash + FirstName.GetHashCode();
            hash = 83 * hash + SurName.GetHashCode();
            hash = 83 * hash + EmailAdress.GetHashCode();
            hash = 83 * hash + PhoneNumber.GetHashCode();
            hash = 83 * hash + Birthday.GetHashCode();
            hash = 83 * hash + SerialNumber;
            return(hash);
        }
        public IActionResult AddEmail(AddEmailViewModel request)
        {
            var valid = false;

            try
            {
                var addr = new System.Net.Mail.MailAddress(request.Email);
                valid = addr.Address == request.Email;
            }
            catch
            {
                valid = false;
            }

            if (!valid)
            {
                return(BadRequest());
            }

            var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var role   = User.FindFirst(ClaimTypes.Role)?.Value;

            var app = _unitOfWork.Repository <Application>().FirstEntityWithEagerLoad(x => x.ApplicationId == request.AppId, new string[1] {
                "EmailAdresses"
            });

            if (app == null)
            {
                return(BadRequest());
            }

            if (role != "Administrator" && app.UserId != userId)
            {
                return(BadRequest());
            }

            var emailAddress = new EmailAdress()
            {
                Email = _htmlEncoder.Encode(request.Email)
            };

            app.EmailAdresses.Add(emailAddress);

            _unitOfWork.Save();

            return(Ok(new SelectListItem(emailAddress.Email, emailAddress.Id.ToString())));
        }
示例#3
0
 public FeedbackFormPage InputEmailAdress(EmailAdress email)
 {
     enterEmaitText.SendKeys(email.AdressOfEmail);
     return(this);
 }
示例#4
0
 public bool IsSatisfiedBy(Attendee atendee)
 {
     return(EmailAdress.Validate(atendee.Email));
 }
示例#5
0
 public override int GetHashCode()
 {
     return(Name.GetHashCode() ^ LastName.GetHashCode() ^ EmailAdress.GetHashCode());
 }