Exemple #1
0
 public List <Tapahtumat> KaikkiTapahtumat()
 {
     using (EventDBContext db = new EventDBContext())
     {
         return(t.KaikkiTapahtumat());
     }
 }
Exemple #2
0
 public IActionResult Index()
 {
     using (EventDBContext db = new EventDBContext())
     {
         return(View());
     }
 }
 public string Kartta()
 {
     using (EventDBContext db = new EventDBContext())
     {
         var data = db.Tapahtumat.ToList();
         return(JsonConvert.SerializeObject(data));
     }
 }
 // GET: Tapahtuma/Delete/5
 public ActionResult Delete(int id)
 {
     using (EventDBContext db = new EventDBContext())
     {
         var t = db.Tapahtumat.Where(a => a.TapahtumaId == id).FirstOrDefault();
         return(View(t));
     }
 }
Exemple #5
0
 public IEnumerable <Tapahtumat> GetByName(string nimi)
 {
     using (EventDBContext db = new EventDBContext())
     {
         var tapahtuma = db.Tapahtumat.Where(a => a.Nimi.ToLower().Contains(nimi.ToLower())).ToList();
         return(tapahtuma);
     }
 }
Exemple #6
0
 public Tapahtumat Get(int id)
 {
     using (EventDBContext db = new EventDBContext())
     {
         Tapahtumat t = db.Tapahtumat.Where(a => a.TapahtumaId == id).FirstOrDefault();
         return(t);
     }
 }
Exemple #7
0
 public void Post([FromBody] Kayttajat kayttaja)
 {
     using (EventDBContext db = new EventDBContext())
     {
         db.Kayttajat.Add(kayttaja);
         db.SaveChanges();
     }
 }
Exemple #8
0
        public void Delete(int id)
        {
            using (EventDBContext db = new EventDBContext())
            {
                Tapahtumat t = db.Tapahtumat.Find(id);

                db.Tapahtumat.Remove(t);
                db.SaveChanges();
            }
        }
Exemple #9
0
 private void InitializeDataGrid()
 {
     EventDBContext.IntitalizeDB();
     events = EventDBContext.GetEvents();
     EventDataGrid.Items.Clear();
     foreach (EventDBContext eventt in events)
     {
         EventDataGrid.Items.Add(eventt);
     }
 }
Exemple #10
0
 public SearchController(EventDBContext context)
 {
     _context = context;
     if (_context.event_collects.Count() == 0)
     {
         _context.event_collects.Add(new DOEvent {
             event_id = Guid.NewGuid().ToString()
         });
         _context.SaveChanges();
     }
 }
Exemple #11
0
        private void EventDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            EventDBContext eventt = ((EventDBContext)EventDataGrid.SelectedItem);

            if (eventt != null)
            {
                eventId          = eventt.Id;
                EventDate.Text   = eventt.EventDate;
                EventAdress.Text = eventt.EventAddress;
                EventDetail.Text = eventt.EventDetail;
            }
        }
Exemple #12
0
 public void Post([FromBody] Tapahtumat tapahtumat)
 {
     using (EventDBContext db = new EventDBContext())
     {
         var paikkapalvelu = new GoogleLocationService(Environment.GetEnvironmentVariable("APIKey"));
         var latlong       = paikkapalvelu.GetLatLongFromAddress(tapahtumat.Sijainti);
         tapahtumat.Lat  = latlong.Latitude;
         tapahtumat.Long = latlong.Longitude;
         db.Tapahtumat.Add(tapahtumat);
         db.SaveChanges();
     }
 }
Exemple #13
0
 private void UpdateButton_Click(object sender, RoutedEventArgs e)
 {
     if (ValidateAll() && eventId != 0)
     {
         EventDBContext.IntitalizeDB();
         EventDBContext.Update(eventId, EventDate.Text.ToString(), EventAdress.Text.ToString(), EventDetail.Text.ToString().Trim());
         InitializeDataGrid();
         ClearAll();
         WindowSuccess success = new WindowSuccess();
         success.SetContent("Event Updated Succefully");
         success.Show();
     }
     else
     {
         WindowError error = new WindowError();
         error.SetContent("Event Is Not Selected");
         error.Show();
     }
 }
Exemple #14
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     if (eventId != 0)
     {
         EventDBContext.IntitalizeDB();
         EventDBContext.Delete(eventId);
         InitializeDataGrid();
         ClearAll();
         WindowSuccess success = new WindowSuccess();
         success.SetContent("Event Deleted Succefully");
         success.Show();
     }
     else
     {
         WindowError error = new WindowError();
         error.SetContent("Event Is Not Selected");
         error.Show();
     }
 }
Exemple #15
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (ValidateAll())
     {
         EventDBContext.IntitalizeDB();
         EventDBContext.Inserst(EventDate.Text.ToString(), EventAdress.Text.ToString(), EventDetail.Text.ToString().Trim());
         InitializeDataGrid();
         ClearAll();
         WindowSuccess success = new WindowSuccess();
         success.SetContent("Event Saved Succefully");
         success.Show();
     }
     else
     {
         WindowError error = new WindowError();
         error.SetContent("Empty Filed Or Invalid Input");
         error.Show();
     }
 }
        public ActionResult Submit(FormCollection fc)
        {
            string email = fc["email"];
            string psw   = fc["psw"];

            if (ModelState.IsValid)
            {
                using (EventDBContext db = new EventDBContext())
                {
                    var obj = db.logins.Where(model => model.Email.Equals(email) && model.Password.Equals(psw)).FirstOrDefault();
                    if (obj != null)
                    {
                        Session["login_ID"] = obj.login_ID.ToString();
                        Session["Email"]    = obj.Email.ToString();
                        return(RedirectToAction("UserDashBoard"));
                    }
                }
            }
            return(Content("check your credentials"));
        }
Exemple #17
0
 public void Put(int id, [FromBody] Tapahtumat tapahtumat)
 {
     using (EventDBContext db = new EventDBContext())
     {
         Tapahtumat t             = db.Tapahtumat.Find(id);
         var        paikkapalvelu = new GoogleLocationService(Environment.GetEnvironmentVariable("APIKey"));
         var        latlong       = paikkapalvelu.GetLatLongFromAddress(t.Sijainti);
         t.Lat        = latlong.Latitude;
         t.Long       = latlong.Longitude;
         t.Hinta      = tapahtumat.Hinta;
         t.Ikäraja    = tapahtumat.Ikäraja;
         t.Kategoria  = tapahtumat.Kategoria;
         t.Kuva       = tapahtumat.Kuva;
         t.Kuvaus     = tapahtumat.Kuvaus;
         t.Linkki     = tapahtumat.Linkki;
         t.Nimi       = tapahtumat.Nimi;
         t.Päivämäärä = tapahtumat.Päivämäärä;
         t.Sijainti   = tapahtumat.Sijainti;
         db.SaveChanges();
     }
 }
Exemple #18
0
 public IActionResult Validate(Kayttajat admin)
 {
     using (EventDBContext db = new EventDBContext())
     {
         var _admin = db.Kayttajat.Where(s => s.Email == admin.Email);
         if (_admin.Any())
         {
             if (_admin.Where(s => s.Password == admin.Password).Any())
             {
                 return(Json(new { status = true, message = "Login Successful!" }));
             }
             else
             {
                 return(Json(new { status = false, message = "Invalid Password!" }));
             }
         }
         else
         {
             return(Json(new { status = false, message = "Invalid Email!" }));
         }
     }
 }
 public EventRepository(EventDBContext db)
 {
     dBContext = db;
     entities  = dBContext.Set <T>();
 }
 public EventManager(EventDBContext db)
 {
     _db = db;
 }
 public BadEventsController(EventDBContext context)
 {
     _context = context;
 }
 public RemindersController(EventDBContext context)
 {
     _context = context;
 }
Exemple #23
0
 public UsersController(EventDBContext context)
 {
     _context = context;
 }