public AttendanceForm() { InitializeComponent(); _context = new EdirDbContext(); eve = new EdirEvent(); attendance = new Attendace(); }
public IHttpActionResult Attend([FromBody] string sourceId) { var userId = User.Identity.GetUserId(); if (_dbContext.Attendances.Any(a => a.AttendeeId == userId && a.SourceId == sourceId)) { return(BadRequest("The Attendace already exists")); } var attendance = new Attendace { SourceId = sourceId, AttendeeId = userId }; _dbContext.Attendances.Add(attendance); _dbContext.SaveChanges(); return(Ok()); }
private void Details_Click(object sender, RoutedEventArgs e) { EdirEvent Selected = ((EdirEvent)EventGrid.SelectedItem); if (Selected != null) { Attendace pre = _context.Attendances.FirstOrDefault(p => p.EventId == Selected.Id); if (pre == null) { AttendanceForm at = new AttendanceForm(); at.GridInitializer(EventGrid); AttendanceForm.Children.Clear(); AttendanceForm.Children.Add(at); } else { ErrorMessage er = new ErrorMessage(); er.MessageText.Text = "Attendance already registered"; er.Show(); } } }
public IHttpActionResult Attend(AttendanceDto dto) { var userId = User.Identity.GetUserId(); var exists = _context.Attendaces.Any(a => a.AttendeeId == userId && a.GigId == dto.GigId); if (exists) { return(BadRequest("The attendace already exists")); } var attendace = new Attendace { GigId = dto.GigId, AttendeeId = userId }; _context.Attendaces.Add(attendace); _context.SaveChanges(); return(Ok()); }