public ActionResult LogIn(WrapperUserObject userInput)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var result = _customerUsersLogic.AuthenticateCustomer(userInput.UserLoginObject.Email, userInput.UserLoginObject.Password);
                    if (result)
                    {
                        Session["LoggedIn"] = true;
                        Session["Username"] = userInput.UserLoginObject.Email;
                    }
                    else
                    {
                        var errorWrapper = new WrapperUserObject("Incorrect username or password", true);
                        return(View("LogInModal", errorWrapper));
                    }
                }
                catch (Exception e)
                {
                    var errorWrapper = new WrapperUserObject(e.ToString(), true);
                    return(View("LogInModal", errorWrapper));
                }

                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("LogInModal"));
        }
        public ActionResult Register(WrapperUserObject userInput)
        {
            if (ModelState.IsValid)
            {
                var customer = _customerUsersLogic.Get(userInput.UserRegistrationObject.Email);
                if (customer == null)
                {
                    var customerModelBLL = new CustomerModelBLL()
                    {
                        Email     = userInput.UserRegistrationObject.Email,
                        Password  = userInput.UserRegistrationObject.Password,
                        FirstName = userInput.UserRegistrationObject.FirstName,
                        LastName  = userInput.UserRegistrationObject.LastName
                    };

                    var result = _customerUsersLogic.Create(customerModelBLL);

                    if (result)
                    {
                        Session["LoggedIn"] = true;
                        Session["Username"] = userInput.UserRegistrationObject.Email;
                    }
                }
                else
                {
                    var errorWrapper = new WrapperUserObject("Email already in use/Already existing user");
                    return(View("LogInModal", errorWrapper));
                }

                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("LogInModal"));
        }
        public ActionResult UserNotLoggedInRedirect()
        {
            var errorWrapper = new WrapperUserObject("You need to log in or register an account in order to use our services");

            return(View("LogInModal", errorWrapper));
        }