public async Task <IActionResult> Edit(Guid id, [Bind("ID,CreatedDateUtc,IsActive,Name,Description")] LeadNote leadNote) { if (id != leadNote.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(leadNote); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeadNoteExists(leadNote.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(leadNote)); }
public ActionResult DeleteNote(LeadNoteHelper model) { LeadNote leadNote = _db.LeadNotes.Find(model.NoteId); _db.LeadNotes.Remove(leadNote ?? throw new InvalidOperationException()); _db.SaveChanges(); return(RedirectToAction("Details", new { id = model.RelatedLeadId })); }
public async Task <IActionResult> Create([Bind("ID,CreatedDateUtc,IsActive,Name,Description")] LeadNote leadNote) { if (ModelState.IsValid) { leadNote.ID = Guid.NewGuid(); _context.Add(leadNote); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(leadNote)); }
public bool EditLead(LeadData lead) { bool isSalesEdited = false; using (uow = new UnitOfWork.UnitOfWork()) { try { Lead leaddb = uow.LeadRepository.Get().Where(x => x.LeadID == lead.LeadID).FirstOrDefault(); leaddb.BusinessName = lead.BusinessName; leaddb.ComplianceAgent = lead.ComplianceAgent; leaddb.ContactName = lead.ContactName; leaddb.Date = DateTime.Now.Date.ToShortDateString(); leaddb.DOTNo = lead.DOTNo; leaddb.Email = lead.Email; leaddb.PhoneNoForContact = lead.PhoneNoForContact; leaddb.ServiceDiscussed = lead.ServiceDiscussed; leaddb.SalesPersonID = lead.SalesPersonID; uow.LeadRepository.Update(leaddb); uow.Save(); if (!String.IsNullOrEmpty(lead.Notes) && !String.IsNullOrEmpty(lead.TimeLine)) { LeadNote leadNote = new LeadNote(); leadNote.LeadID = leaddb.LeadID; leadNote.Note = lead.Notes; leadNote.Timeline = lead.TimeLine; leadNote.NoteLeftAt = DateTimeJavaScript.GetCurrentTime().ToString(); uow.LeadNoteRepository.Insert(leadNote); uow.Save(); } isSalesEdited = true; } catch { isSalesEdited = false; } } return(isSalesEdited); }
public bool AddLead(LeadData lead) { bool isSalesAdded = false; using (uow = new UnitOfWork.UnitOfWork()) { try { Lead leaddb = new Lead(); leaddb.BusinessName = lead.BusinessName; leaddb.ComplianceAgent = lead.ComplianceAgent; leaddb.ContactName = lead.ContactName; leaddb.Date = DateTime.Now.Date.ToShortDateString(); leaddb.DOTNo = lead.DOTNo; leaddb.Email = lead.Email; leaddb.PhoneNoForContact = lead.PhoneNoForContact; leaddb.ServiceDiscussed = lead.ServiceDiscussed; leaddb.SalesPersonID = lead.SalesPersonID; uow.LeadRepository.Insert(leaddb); uow.Save(); LeadNote leadNote = new LeadNote(); leadNote.LeadID = leaddb.LeadID; leadNote.Note = lead.Notes; leadNote.Timeline = lead.TimeLine; leadNote.NoteLeftAt = DateTimeJavaScript.GetCurrentTime().ToString(); uow.LeadNoteRepository.Insert(leadNote); uow.Save(); isSalesAdded = true; } catch { isSalesAdded = false; } } return(isSalesAdded); }
public void Delete(LeadNote entity) { Repository.Delete(entity); }
public void Add(LeadNote entity) { Repository.Add(entity); }