Beispiel #1
0
        public List <Event> GetUserEvent(User u)
        {
            MeetUpContext baza  = new MeetUpContext();
            List <Event>  lista = baza.Events.Where(x => x.User.userId == u.userId).ToList();

            return(lista);
        }
Beispiel #2
0
        public List <User> GetUser()
        {
            MeetUpContext baza  = new MeetUpContext();
            List <User>   lista = baza.Users.ToList();

            return(lista);
        }
Beispiel #3
0
        public ActionResult Logowanie(User user, string ReturnUrl)
        {
            MeetUpContext baza      = new MeetUpContext();
            var           daneUsera = baza.Users.Where(k => k.login == user.login && k.password == user.password).FirstOrDefault();
            UserAdd       ktos      = new UserAdd();
            List <User>   lista     = ktos.GetUser();

            //if (daneUsera == null)
            //{
            //    ModelState.AddModelError("login", "Błędny login lub hasło");
            //    return View("Logowanie", user);
            //}
            if (!lista.Any(k => k.login == user.login && k.password == user.password))
            {
                ModelState.AddModelError("password", "Błędny login lub hasło");
                return(View("Logowanie", user));
            }
            else
            {
                Session["userId"] = daneUsera.userId;
                Session["login"]  = daneUsera.login;
                FormsAuthentication.SetAuthCookie(user.login, false);

                if (Url.IsLocalUrl(ReturnUrl))
                {
                    return(Redirect(ReturnUrl));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
        }
Beispiel #4
0
        public void AddUser(User u)
        {
            MeetUpContext baza = new MeetUpContext();

            baza.Users.Add(u);
            baza.Configuration.ValidateOnSaveEnabled = false;
            baza.SaveChanges();
        }
Beispiel #5
0
        public User ZnajdzUsera(int id)
        {
            User          c    = new User();
            MeetUpContext baza = new MeetUpContext();

            baza.Users.Attach(c);
            c = baza.Users.Find(id);
            return(c);
        }
Beispiel #6
0
        private static async Task InsertMeetUpSampleData(MeetUpContext meetUpDb)
        {
            var meetUps = GetMeetUps();

            meetUpDb.MeetUps.AddRange(meetUps);
            try
            {
                await meetUpDb.SaveChangesAsync();
            }
            catch (Exception exp)
            {
                //todo log error
                throw;
            }
        }
Beispiel #7
0
 public RunnerRepository(MeetUpContext db)
 {
     _db = db;
 }
Beispiel #8
0
 public AddressRepository(MeetUpContext meetUpContext)
 {
     _meetUpContext = meetUpContext;
 }
Beispiel #9
0
 public UserPicRepository(MeetUpContext db)
 {
     _db = db;
 }
Beispiel #10
0
 public SeatRepository(MeetUpContext context)
 {
     _context = context;
 }
Beispiel #11
0
 public EmailRepository(MeetUpContext db)
 {
     _db = db;
 }
Beispiel #12
0
 public MeetUpRepository(MeetUpContext context)
 {
     _context = context;
 }
Beispiel #13
0
 public BookingRepository(MeetUpContext context)
 {
     _context = context;
 }
Beispiel #14
0
 public MeetUpRepository(MeetUpContext meetUpContext)
 {
     _meetUpContext = meetUpContext;
 }
Beispiel #15
0
 public OcassionCommentRepository(MeetUpContext db)
 {
     _db = db;
 }
Beispiel #16
0
 public VenueRepository(MeetUpContext db)
 {
     _db = db;
 }
 public OccasionRepository(MeetUpContext db)
 {
     _db = db;
 }
Beispiel #18
0
 public UserAccountRepository(MeetUpContext db)
 {
     _db = db;
 }
Beispiel #19
0
 public RSVPRepository(MeetUpContext db)
 {
     _db = db;
 }
Beispiel #20
0
 public LectureRepository(MeetUpContext meetUpContext)
 {
     _meetUpContext = meetUpContext;
 }
Beispiel #21
0
 public UserRepository(MeetUpContext meetUpContext)
 {
     _meetUpContext = meetUpContext;
 }
Beispiel #22
0
        public List <Event> GetEvents()
        {
            MeetUpContext db = new MeetUpContext();

            return(db.Events.ToList());
        }