public void SendInfoMail(UsersDetails RegisteredUserDetail)
        {
            SensorMonitoringSystemEntities SMSE = new SensorMonitoringSystemEntities();

            var UserEntity       = (from p in SMSE.Users where p.UserID == RegisteredUserDetail.UserID select p).FirstOrDefault();
            var UserDetailEntity = (from p in SMSE.UsersDetails where p.UserID == RegisteredUserDetail.UserID select p).FirstOrDefault();

            var          fromAddress  = new MailAddress("*****@*****.**", "TechExpert Officer");
            var          toAddress    = new MailAddress(UserDetailEntity.Email, UserEntity.Name + " " + UserEntity.Surname);
            const string fromPassword = "******";
            const string subject      = "Sensor Monitoring System Registration";

            string body = "Your username is " + UserEntity.Username +
                          " and your password is " + UserEntity.Password +
                          " and your activation code is " + UserEntity.RegistrationCode;

            var smtp = new SmtpClient
            {
                Host           = "smtp.gmail.com",
                Port           = 587,
                EnableSsl      = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Credentials    = new NetworkCredential(fromAddress.Address, fromPassword),
                Timeout        = 20000
            };

            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                smtp.Send(message);
            }
        }
        public void RegisterUserDetail(UsersDetails RegisteredUserDetail)
        {
            SensorMonitoringSystemEntities SMSE = new SensorMonitoringSystemEntities();

            SMSE.UsersDetails.Add(new UsersDetailsEntity
            {
                UserID      = RegisteredUserDetail.UserID,
                City        = RegisteredUserDetail.City,
                Adress      = RegisteredUserDetail.Address,
                DateOfBirth = RegisteredUserDetail.DateOfBirth,
                Email       = RegisteredUserDetail.Email,
            });

            SMSE.SaveChanges();
        }