public void Test_Delete() { var eventData = _fixture.CreateMany <byte>().ToArray(); var partitionId = _fixture.Create <int>(); var type = _fixture.Create <EventType>(); _events.Add(partitionId, TestConstants.TestAdminUserId, type, EventState.Emailing, eventData); var data = _events.GetNext(type, partitionId); _events.Delete(data.Id); data = _events.GetNext(type, partitionId); data.Should().BeNull(); }
public void Delete(long[] ids) { using (var repo = new EventRepository()) { repo.Delete(ids); } }
public void Delete(int id) { using (var repo = new EventRepository()) { repo.Delete(id); } }
public ActionResult Delete(int id) { var efEvent = _eventRepository.FindBy(i => i.Id == id).SingleOrDefault(); _eventRepository.Delete(id); return(RedirectToAction("ManageIndex")); }
public int DeleteEvent(Event eventToDelete) { using (var repo = new EventRepository()) { repo.Delete(eventToDelete); return repo.Save(); } }
public void DeleteEvent(int eventId) { using (var uow = UnitOfWorkProvider.Create()) { _eventRepository.Delete(eventId); uow.Commit(); } }
public int DeleteEvent(Event eventToDelete) { using (var repo = new EventRepository()) { repo.Delete(eventToDelete); return(repo.Save()); } }
public void DeleteTest() { var mockContext = GetMockContext(); var repository = new EventRepository(mockContext.Object); var item = mockContext.Object.Events.First(); repository.Delete(item); Assert.Null(mockContext.Object.Events.Find(item.Id)); }
public ActionResult DeleteEvent(int id) { EventRepository eventRepository = RepositoryFactory.GetEventRepository(); Event even = eventRepository.GetById(id); eventRepository.Delete(even); return(RedirectToAction("Index", "EventManagement")); }
public ActionResult Delete(int id) { var eventRepository = new EventRepository(); var entity = eventRepository.GetById(id); eventRepository.Delete(entity); return(RedirectToAction("Index")); }
public void Delete() { Planning planningOutput = _planningRepository.Create(_planningInput); Event eventInput = new Event(0, 1, planningOutput.Id, "label", "20-05-05 00:00:00", "20-05-05 00:00:00"); Event eventOutput = _eventRepository.Create(eventInput); bool isDeleted = _eventRepository.Delete(eventOutput.Id); Assert.True(isDeleted); }
public void DeleteItem(Event item) { if (item != null) { if (_eventRepository.Exists(item)) { _eventRepository.Delete(item); } } }
public JsonResult DeleteEvent(int eventID) { Events events = new Events(); eventRepository.Delete(eventID); var status = true; return(new JsonResult { Data = new { status = status } }); }
/// <summary> /// Permanently delete all events from the data store that are system-wide (that is, not associated with a specific gallery) and also /// those events belonging to the specified <paramref name="galleryId" />. /// </summary> /// <param name="galleryId">The gallery ID.</param> public static void ClearEventLog(int galleryId) { using (var repo = new EventRepository()) { foreach (var eDto in repo.Where(e => e.FKGalleryId == galleryId || e.Gallery.IsTemplate)) { repo.Delete(eDto); } repo.Save(); } }
public IActionResult DeleteEvent(int id) { try { eventRepository.Delete(id); return(Ok()); } catch (Exception exe) { return(BadRequest(exe.Message)); } }
public ActionResult Delete(EventsDeleteViewModel model) { EventRepository repository = new EventRepository(); if (model.Id.ToString() != String.Empty) { repository.Delete(model.Id); } return(RedirectToAction("Index")); }
/// <summary> /// Permanently remove the specified event from the data store. /// </summary> /// <param name="eventId">The value that uniquely identifies this application event (<see cref="IEvent.EventId"/>).</param> public static void Delete(int eventId) { using (var repo = new EventRepository()) { var aeDto = repo.Find(eventId); if (aeDto != null) { repo.Delete(aeDto); repo.Save(); } } }
public IHttpActionResult DeleteEvent(int id) { Event @event = repository.GetById(id); if (@event == null) { return(NotFound()); } repository.Delete(@event); return(Ok(@event)); }
public bool DeleteEvent(int EventID) { try { eventRepository.Delete(EventID); eventRepository.Save(); return(true); } catch (Exception) { return(false); } }
public IHttpActionResult Delete(int id) { EventRepository repository = new EventRepository(); Event _event = repository.GetById(id); if (_event == null) { return(NotFound()); } repository.Delete(_event); return(Ok()); }
public IHttpActionResult Delete(Guid id) { try { var eventItem = _eventRepository.GetById(id); _eventRepository.Delete(id); } catch (Exception e) { return(InternalServerError(e)); } return(Content(HttpStatusCode.NoContent, "Gebeurtenis is met succes verwijderd.")); }
public IActionResult DeleteConfirmed(EventDTO obj) { try { bool result = _repository.Delete(obj.Id, _userManager.GetUserName(this.User)); } catch (ConcurrencyException ex) { ModelState.AddModelError("", ex.Message); return(View(obj)); } return(RedirectToAction(nameof(Index))); }
public void Execute(IJobExecutionContext context) { log.Info("EventPublisher is executing"); var eventRepository = new EventRepository(_store.OpenSession()); var events = eventRepository.ListAll(); // Process the new events Parallel.ForEach(events, Notify); // Delete the recevied events Parallel.ForEach(events, evt => { if (evt.Recevied) { eventRepository.Delete(evt); } }); }
public IHttpActionResult Delete(int id) { var headers = Request.Headers; if (!headers.Contains("auth_token") && !headers.Contains("fb_auth")) { return(Ok(new { errorCode = "66", message = "unauthorized" })); } if (headers.Contains("auth_token")) { var token = headers.GetValues("auth_token").First(); if (!_authToken.VerifyToken(token)) { return(Ok(new { errorCode = "66", message = "unauthorized" })); } } _eventRepository.Delete(id); return(Ok()); }
/// <summary> /// If automatic log size trimming is enabled and the log contains more items than the specified limit, delete the oldest /// event records. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero. Return the number of /// items that were deleted, if any. /// </summary> /// <param name="maxNumberEventItems">The maximum number of event items that should be stored in the log. If the count exceeds /// this amount, the oldest items are deleted. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero.</param> /// <returns>Returns the number of items that were deleted from the log.</returns> public static int ValidateLogSize(int maxNumberEventItems) { if (maxNumberEventItems == 0) { return(0); // Auto trimming is disabled, so just return. } var events = GetAppEvents(); var numErrors = events.Count; var numErrorDeleted = 0; using (var repo = new EventRepository()) { while (numErrors > maxNumberEventItems) { // Find oldest event and delete it. var aeDto = repo.Find(events[numErrors - 1].EventId); if (aeDto != null) { repo.Delete(aeDto); } numErrors--; numErrorDeleted++; } try { repo.Save(); } catch (DbUpdateConcurrencyException ex) { // When multiple threads call this method, the 2nd thread might try to delete rows that were deleted by the // first thread. This isn't a problem, but let's log it in case something else is happening that we should be alerted to. RecordEvent(String.Concat("The following error occurred while trimming the event log. It can be ignored if it occurs infrequently. ", GetExceptionDetails(ex))); } } return(numErrorDeleted); }
public void Delete(Event obj) { if (null != obj.Images) { for (int i = obj.Images.Count - 1; i >= 0; i--) { EventImage image = _imageRepository.Get(obj.Images[i].Id); _imageRepository.Delete(image); if (File.Exists(image.Path)) { File.Delete(image.Path); } } obj.Images.Clear(); } _eventRepository.Delete(obj); }
public ActionResult Delete(Event ev) { try { var pictures = repoEvent.GetSet().Where(e => e.Id == ev.Id).Include(e => e.Pictures).First().Pictures; foreach (Picture p in pictures) { var FilePath = Path.Combine(Server.MapPath("~/Content/media/img/") + p.FileName); System.IO.File.Delete(FilePath); } Context.Pictures.RemoveRange(pictures); Context.SaveChanges(); repoEvent.Delete(ev.Id); return(RedirectToAction("Index")); } catch { return(View("Index")); } }
public void DeleteEventTest() { // Arrange HollywoodTestEntities dataContext = new HollywoodTestEntities(); EventRepository eventRepository = new EventRepository(dataContext); Event _event = new Event() { TournamentID = 1, EventName = "Delete Event Data Access Unit Test", EventNumber = 1, EventDateTime = Convert.ToDateTime("2019-04-16"), EventEndDateTime = Convert.ToDateTime("2019-06-16"), AutoClose = true, }; // Act int eventId = eventRepository.Create(_event); bool isDeleted = eventRepository.Delete(eventId); // Assert Assert.IsTrue(isDeleted); }
public ActionResult DeleteConfirmed(Event ev) { try { var pictures = from p in Context.Pictures select p; foreach (Picture p in pictures) { if (p.Id == ev.Id) { Context.Pictures.Remove(p); } } repoEvent.Delete(ev.Id); return(RedirectToAction("Index")); } catch { return(View("Index")); } }
/// <summary> /// If automatic log size trimming is enabled and the log contains more items than the specified limit, delete the oldest /// event records. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero. Return the number of /// items that were deleted, if any. /// </summary> /// <param name="maxNumberEventItems">The maximum number of event items that should be stored in the log. If the count exceeds /// this amount, the oldest items are deleted. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero.</param> /// <returns>Returns the number of items that were deleted from the log.</returns> public static int ValidateLogSize(int maxNumberEventItems) { if (maxNumberEventItems == 0) { return(0); // Auto trimming is disabled, so just return. } var numErrorDeleted = 0; lock (_sharedLock) { using (var repo = new EventRepository()) { foreach (var e in repo.All.OrderByDescending(ae => ae.EventId).Skip(maxNumberEventItems)) { repo.Delete(e); numErrorDeleted++; } repo.Save(); } } return(numErrorDeleted); }
public void DeleteEvent(string eventId) { EventRepository.Delete(eventId); }
/// <summary> /// If automatic log size trimming is enabled and the log contains more items than the specified limit, delete the oldest /// event records. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero. Return the number of /// items that were deleted, if any. /// </summary> /// <param name="maxNumberEventItems">The maximum number of event items that should be stored in the log. If the count exceeds /// this amount, the oldest items are deleted. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero.</param> /// <returns>Returns the number of items that were deleted from the log.</returns> public static int ValidateLogSize(int maxNumberEventItems) { if (maxNumberEventItems == 0) return 0; // Auto trimming is disabled, so just return. var events = GetAppEvents(); var numErrors = events.Count; var numErrorDeleted = 0; using (var repo = new EventRepository()) { while (numErrors > maxNumberEventItems) { // Find oldest event and delete it. var aeDto = repo.Find(events[numErrors - 1].EventId); if (aeDto != null) repo.Delete(aeDto); numErrors--; numErrorDeleted++; } try { repo.Save(); } catch (DbUpdateConcurrencyException ex) { // When multiple threads call this method, the 2nd thread might try to delete rows that were deleted by the // first thread. This isn't a problem, but let's log it in case something else is happening that we should be alerted to. RecordEvent(String.Concat("The following error occurred while trimming the event log. It can be ignored if it occurs infrequently. ", GetExceptionDetails(ex))); } } return numErrorDeleted; }