public ActionResult Login(Models.Membership model)
 {
     using (var context = new projekt_baza_danych_wycieczki())
     {
         bool isValid = context.User.Any(x => x.UserName == model.UserName && x.Password == model.Password);
         if (isValid)
         {
             FormsAuthentication.SetAuthCookie(model.UserName, false);
             return(RedirectToAction("Index", "Home"));
         }
         ModelState.AddModelError("", "Błędna nazwa lub hasło.");
         return(View());
     }
 }
 public ActionResult Signup(User model)
 {
     if (db.User.Where(u => u.UserName == model.UserName).Any())
     {
         ModelState.AddModelError("UserName", "Nazwa użytkownika zajęta");
         return(View(model));
     }
     else
     {
         using (var context = new projekt_baza_danych_wycieczki())
         {
             model.Rola = "User";
             context.User.Add(model);
             context.SaveChanges();
         }
         return(RedirectToAction("login"));
     }
 }