public IActionResult Cancel(int id) { Participation deletedEvet = pRepository.DeleteParticipatedEvent(id); if (deletedEvet != null) { var dbEntry = ceRepository.CreatedEvents.Where(c => c.ID == deletedEvet.CreatedEventID).FirstOrDefault(); dbEntry.CountOfParticipation -= 1; ceRepository.SaveEvent(dbEntry); // TempData["message"] = $"{deletedProduct.Title} was deleted"; } return(RedirectToAction("Participated")); }