/// <summary> /// This function will edit Demo Lead /// </summary> /// <param name="demoLead">demoLead</param> /// <returns>bool depending upon result</returns> public bool EditDemoLead(DemoLead demoLead) { try { using (var unitOfWork = new EFUnitOfWork()) { var demoLeadRepo = new DemoLeadRepository(new EFRepository <DemoLead>(), unitOfWork); ObjectSet <DemoLead> demoLeadObjSet = ((CurrentDeskClientsEntities)demoLeadRepo.Repository.UnitOfWork.Context).DemoLeads; //Get The Selected tunning and assign its Properties. var selectedDemoLead = demoLeadObjSet.Where(demol => demol.PK_LeadID.Equals(demoLead.PK_LeadID)).FirstOrDefault(); //Will Add All The Attributes selectedDemoLead.Password = demoLead.Password; selectedDemoLead.PhoneNo = demoLead.PhoneNo; demoLeadRepo.Save(); return(true); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This Function Will return all the demo Leads /// </summary> /// <returns></returns> public List <DemoLead> GetDemoLeads() { try { using (var unitOfWork = new EFUnitOfWork()) { var demoLeadRepo = new DemoLeadRepository(new EFRepository <DemoLead>(), unitOfWork); //Returning List Of Demo Lead return(demoLeadRepo.All().ToList()); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This Function Will add new demolead to database /// </summary> /// <param name="demoLead">demoLead</param> /// <returns>bool depending upon result</returns> public bool AddNewDemoLead(DemoLead demoLead) { try { using (var unitOfWork = new EFUnitOfWork()) { var demoLeadRepo = new DemoLeadRepository(new EFRepository <DemoLead>(), unitOfWork); demoLeadRepo.Add(demoLead); demoLeadRepo.Save(); return(true); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This Function will get the selected demolead /// </summary> /// <param name="demoLeadID"></param> /// <returns></returns> public DemoLead GetSelectedDemoLead(int demoLeadID) { try { using (var unitOfWork = new EFUnitOfWork()) { var demoLeadRepo = new DemoLeadRepository(new EFRepository <DemoLead>(), unitOfWork); ObjectSet <DemoLead> demoLeadObjSet = ((CurrentDeskClientsEntities)demoLeadRepo.Repository.UnitOfWork.Context).DemoLeads; return(demoLeadObjSet.Where(dl => dl.PK_LeadID.Equals(demoLeadID)).FirstOrDefault()); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This method returns true if passed emailID exists in DemoLead table /// </summary> /// <param name="emailID">emailID</param> /// <returns>bool</returns> public bool CheckIfEmailExistsInDemoLead(string emailID, int organizationID) { try { using (var unitOfWork = new EFUnitOfWork()) { var demoLeadRepo = new DemoLeadRepository(new EFRepository <DemoLead>(), unitOfWork); ObjectSet <DemoLead> demoLeadObjSet = ((CurrentDeskClientsEntities)demoLeadRepo.Repository.UnitOfWork.Context).DemoLeads; //Return true if email id exists else false return(demoLeadObjSet.Where(lead => lead.EmailAddress == emailID && lead.FK_OrganizationID == organizationID).FirstOrDefault() != null ? true : false); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); return(true); } }