public ActionResult LogIn(LogInModel user, string returnUrl)
        {
            if (ModelState.IsValid)
            {

                if (_kundeBLL.LogIn(user))
                {
                    FormsAuthentication.SetAuthCookie(user.Email, false);
                    if (!String.IsNullOrEmpty(returnUrl))
                    {

                        return Redirect(returnUrl);
                    }
                    else
                    {
                        return RedirectToAction("Index", "Manage");

                    }

                }
                else
                {
                    ModelState.AddModelError("", "Login feilet");

                }
            }
            return View(user);
        }
 public bool LogIn(LogInModel user)
 {
     return _repository.LogIn(user);
 }
 public bool LogIn(LogInModel user)
 {
     return isValid(user.Email, user.Password);// denne blir testet i isValid.
 }
        public bool LogIn(LogInModel user)
        {
            try
            {
                if (user == null || user.Email == null || user.Email == "" || user.Password == null || user.Password == "")
                    return false;
                return isValid(user.Email, user.Password);
            }

            catch (System.Data.SqlClient.SqlException ex)
            {
                SWKR.WriteLine("Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
                "" + Environment.NewLine + "Date :" + DateTime.Now.ToString());
                SWKR.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
            }
            catch (InvalidOperationException ex)
            {
                SWKR.WriteLine("Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
                 "" + Environment.NewLine + "Date :" + DateTime.Now.ToString());
                SWKR.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
            }
            catch (ArgumentException ex)
            {
                SWKR.WriteLine("Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
                 "" + Environment.NewLine + "Date :" + DateTime.Now.ToString());
                SWKR.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
            }
            catch (NullReferenceException ex)
            {
                SWKR.WriteLine("Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
                  "" + Environment.NewLine + "Date :" + DateTime.Now.ToString());
                SWKR.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
            }
            catch (SystemException ex)
            {
                SWKR.WriteLine("Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
                 "" + Environment.NewLine + "Date :" + DateTime.Now.ToString());
                SWKR.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
            }
            catch (Exception ex)
            {
                SWKR.WriteLine("Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
                "" + Environment.NewLine + "Date :" + DateTime.Now.ToString());
                SWKR.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
            }

            return false;
        }