public PrivateEvent getCurrentPrivateEvent() { ApplicationUser currentUser = db.Users.Find(User.Identity.GetUserId()); PrivateEvent currentPrivateEvent = new PrivateEvent(); bool found = false; foreach (PrivateEvent myEvent in db.PrivateEvents) { if (myEvent.UserID == currentUser) { currentPrivateEvent = myEvent; found = true; break; } } if (!found) { PrivateEvent newPrivateList = new PrivateEvent(); newPrivateList.UserID = currentUser; newPrivateList.AdminID = db.Admins.FirstOrDefault(); db.PrivateEvents.Add(newPrivateList); db.SaveChanges(); currentPrivateEvent = newPrivateList; } return(currentPrivateEvent); }
public async Task AddPrivateEvent(PrivateEvent privateEvent) { if (privateEvent != null) { await _context.PrivateEvents.AddAsync(privateEvent); } }
public void InvokeAllEvents() { PublicEvent?.Invoke(); PrivateEvent?.Invoke(); InternalEvent?.Invoke(); ProtectedEvent?.Invoke(); ProtectedInternalEvent?.Invoke(); }
public async Task <IActionResult> Create([Bind("EventId,DepartmentId,EventDate,Price,GuestCapacity,Location,EventType,ImageUrl,Description,IsBooked")] PrivateEvent privateEvent) { if (ModelState.IsValid) { _context.Add(privateEvent); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DepartmentId"] = new SelectList(_context.Department, "DepartmentId", "DepartmentName", privateEvent.DepartmentId); return(View(privateEvent)); }
public async Task <IActionResult> Edit(int id, [Bind("EventId,DepartmentId,EventDate,Price,GuestCapacity,Location,EventType,ImageUrl,Description,IsBooked")] PrivateEvent privateEvent) { if (id != privateEvent.EventId) { return(NotFound()); } if (ModelState.IsValid) { try { PrivateEvent _privateEvent = _context.PrivateEvent.Where(s => s.EventId == privateEvent.EventId).First(); _privateEvent.DepartmentId = privateEvent.DepartmentId; _privateEvent.EventDate = privateEvent.EventDate; _privateEvent.Price = privateEvent.Price; _privateEvent.GuestCapacity = privateEvent.GuestCapacity; _privateEvent.Location = privateEvent.Location; _privateEvent.EventType = privateEvent.EventType; _privateEvent.ImageUrl = privateEvent.ImageUrl; _privateEvent.Description = privateEvent.Description; _privateEvent.IsBooked = privateEvent.IsBooked; _context.Update(_privateEvent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrivateEventExists(privateEvent.EventId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DepartmentId"] = new SelectList(_context.Department, "DepartmentId", "DepartmentName", privateEvent.DepartmentId); return(View(privateEvent)); }
private void PrivateEventHandler(PrivateEvent e) { PrivateEventHandlerInvokeCount++; }
private void OnPrivateEvent(PrivateEvent e) { PrivateEventHandlerInvokeCount++; }
public void RaisePrivateEvent() { PrivateEvent.SafeInvoke(this, EventArgs.Empty); }
public void InvokePrivateEvent() { PrivateEvent?.Invoke(this, new PrivateEventArgs()); }