public List <Tapahtumat> KaikkiTapahtumat() { using (EventDBContext db = new EventDBContext()) { return(t.KaikkiTapahtumat()); } }
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)); } }
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); } }
public Tapahtumat Get(int id) { using (EventDBContext db = new EventDBContext()) { Tapahtumat t = db.Tapahtumat.Where(a => a.TapahtumaId == id).FirstOrDefault(); return(t); } }
public void Post([FromBody] Kayttajat kayttaja) { using (EventDBContext db = new EventDBContext()) { db.Kayttajat.Add(kayttaja); db.SaveChanges(); } }
public void Delete(int id) { using (EventDBContext db = new EventDBContext()) { Tapahtumat t = db.Tapahtumat.Find(id); db.Tapahtumat.Remove(t); db.SaveChanges(); } }
private void InitializeDataGrid() { EventDBContext.IntitalizeDB(); events = EventDBContext.GetEvents(); EventDataGrid.Items.Clear(); foreach (EventDBContext eventt in events) { EventDataGrid.Items.Add(eventt); } }
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(); } }
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; } }
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(); } }
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(); } }
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(); } }
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")); }
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(); } }
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; }
public UsersController(EventDBContext context) { _context = context; }