public ActionResult Suppress(int LeadId) { //Get Lead, Cards for Lead, Appointments for Lead, Accounts for Lead var leadSuppress = GetLeadByLeadId(LeadId); var cardsforlead = _CardRepository.GetCardByLeadId(LeadId); var appointmentsforlead = _AppointmentRepository.GetAppointmentByLeadId(LeadId); var accountsforlead = _AccountRepository.GetAccountsByLeadId(LeadId); //Delete all of them foreach (var card in cardsforlead) { _CardRepository.DeleteCard(card); } foreach (var appointment in appointmentsforlead) { _AppointmentRepository.DeleteAppointmentSheet(appointment); } foreach (var account in accountsforlead) { _AccountRepository.DeleteAccounts(account); } //leadSuppress.Suppressed = true; //We are deleting the lead here after deleting all the cards, accounts and appointmentsheets for him DeleteLead(leadSuppress); return(RedirectToAction("Index")); }
public ActionResult Suppress(string id) { Web.ViewModel.ImportLeadViewModel il = new Web.ViewModel.ImportLeadViewModel(); string[] ids = id.Split(','); // IList<Lead> leads; foreach (string leadid in ids) { int lid = int.Parse(leadid); var leadSuppress = GetLeadByLeadId(lid); var cardsforlead = _CardRepository.GetCardByLeadId(lid); var appointmentsforlead = _AppointmentRepository.GetAppointmentByLeadId(lid); var accountsforlead = _AccountRepository.GetAccountsByLeadId(lid); foreach (var card in cardsforlead) { _CardRepository.DeleteCard(card); } foreach (var appointment in appointmentsforlead) { _AppointmentRepository.DeleteAppointmentSheet(appointment); } foreach (var account in accountsforlead) { _AccountRepository.DeleteAccounts(account); } // leadSuppress.Suppressed = true; DeleteLead(leadSuppress); } return(Redirect("/LeadQueue/Index")); }
public ActionResult Delete(string id) { try { var result = card_repo_.DeleteCard(id); return(this.Ok()); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> DeleteCard([FromBody] Card card) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _cardRepo.DeleteCard(card); if (await _cardRepo.SaveAll()) { return(NoContent()); } throw new Exception($"Fail to remove card!"); }
public CardDto DeleteCard(DeleteCardDto deleteCardDto, string userId) { if (!_listRepository.IsOwner(deleteCardDto.ListId, userId)) { return(null); } var card = _cardRepository.GetCard(deleteCardDto.CardId); if (card == null) { return(null); } var deletedCard = _cardRepository.DeleteCard(card); var cardsWithPositionToUpdate = GetCardsWithPositionToDecrease(deletedCard.ListId, deletedCard.Position); _cardRepository.UpdateCardsPosition(cardsWithPositionToUpdate); var result = _mapper.Map <CardDto>(deletedCard); return(result); }
public void DeleteCard(string id) { Cards.DeleteCard(new Guid(id)); ViewCards.DeleteCard(id); }
public String DeleteCard(String Id) { cardRepository.DeleteCard(Id); return("funcionou"); }
public void DeleteCard(Card card) { _cardRepository.DeleteCard(card.Id); }
public IActionResult Delete(Card card, int id) { _repository.DeleteCard(id); return(RedirectToAction("Index")); }
public async Task RemoveCard(int id) { await _cardRepository.DeleteCard(id); }
public void DeleteCard(int id) { repository.DeleteCard(id); }