public JsonResult ChangeCRMLeadStatus(CRMActivityViewModel vm) { var selectedCRMLead = _crmLeadRepository.Get(vm.CRMLeadId); if (selectedCRMLead != null) { selectedCRMLead.LeadStatusId = vm.StatusId.GetValueOrDefault(); selectedCRMLead.UpdatedByUserId = WebUser.Id; // Send Email Here to Tech Team var selectedStatus = _crmLeadStatusRepository.Get(vm.StatusId.GetValueOrDefault()); // Add it as an Activity if (selectedStatus != null) { var newActivity = new CRMLeadActivity { Title = selectedStatus.Name, Comment = vm.Comment, CRMLeadId = selectedCRMLead.Id, CreatedByUserId = WebUser.Id }; _crmLeadActivityRepository.Create(newActivity); } _crmLeadRepository.Update(selectedCRMLead); _unitOfWork.Commit(); return(Json(true)); } return(Json(false)); }
public ActionResult Details(int id) { var crmLeadStatus = _crmLeadStatusRepository.Get(id); return(CheckForNullAndExecute(crmLeadStatus, () => View(crmLeadStatus))); }
public ActionResult Get(int id) { var apiResult = TryExecute(() => _crmLeadStatusRepository.Get(id), "Lead Status fetched sucessfully"); return(Json(apiResult, JsonRequestBehavior.AllowGet)); }