public IKnowledgeLoginModel SignUp(IKnowledgeLoginModel loginModel)
        {
            if (string.IsNullOrEmpty(loginModel.Name))
            {
                throw new ArgumentNullException("Name can not be null");
            }
            if (string.IsNullOrEmpty(loginModel.OrganizationName))
            {
                throw new ArgumentNullException("Organization can not be null");
            }
            if (string.IsNullOrEmpty(loginModel.EmailId))
            {
                throw new ArgumentNullException("Email Id can not be null");
            }
            if (string.IsNullOrEmpty(loginModel.Password))
            {
                throw new ArgumentNullException("Password can not be null");
            }

            string returnStatus = string.Empty;

            try
            {
                DatabaseConnection.RegisterUsers.Add(new RegisterUser()
                {
                    Email         = loginModel.EmailId,
                    UserFirstName = loginModel.Name,
                    UserLastName  = loginModel.OrganizationName,
                    Password      = loginModel.Password
                });

                DatabaseConnection.SaveChanges();

                RegisterUser userDetail = (from regUser in DatabaseConnection.RegisterUsers
                                           where regUser.Email == loginModel.EmailId && regUser.Password == loginModel.Password &&
                                           regUser.UserRole == _knowledgeUserRole
                                           select regUser).FirstOrDefault();

                if (userDetail != null)
                {
                    _loginModel.EmailId = userDetail.Email;
                    _loginModel.Id      = userDetail.Id;
                }
            }
            catch (Exception ex)
            {
                new KnowledgeException(ex.Message);
            }
            return(_loginModel);
        }
        public IKnowledgeLoginModel SignUp(IKnowledgeLoginModel loginModel)
        {
            if (string.IsNullOrEmpty(loginModel.Name)) throw new ArgumentNullException("Name can not be null");
            if (string.IsNullOrEmpty(loginModel.OrganizationName)) throw new ArgumentNullException("Organization can not be null");
            if (string.IsNullOrEmpty(loginModel.EmailId)) throw new ArgumentNullException("Email Id can not be null");
            if (string.IsNullOrEmpty(loginModel.Password)) throw new ArgumentNullException("Password can not be null");

            string returnStatus = string.Empty;
            try
            {
                DatabaseConnection.RegisterUsers.Add(new RegisterUser()
                {
                    Email = loginModel.EmailId,
                    UserFirstName = loginModel.Name,
                    UserLastName = loginModel.OrganizationName,
                    Password = loginModel.Password
                });

                DatabaseConnection.SaveChanges();

                RegisterUser userDetail = (from regUser in DatabaseConnection.RegisterUsers
                                           where regUser.Email == loginModel.EmailId && regUser.Password == loginModel.Password
                                           && regUser.UserRole == _knowledgeUserRole
                                           select regUser).FirstOrDefault();

                if (userDetail != null)
                {
                    _loginModel.EmailId = userDetail.Email;
                    _loginModel.Id = userDetail.Id;
                }

            }
            catch (Exception ex)
            {
                new KnowledgeException(ex.Message);
            }
            return _loginModel;
        }
 public KnowledgeLogin()
 {
     _loginModel = new IKnowledgeLoginModel();
 }
 public KnowledgeLogin()
 {
     _loginModel = new IKnowledgeLoginModel();
 }