Esempio n. 1
0
        /// <summary>
        /// This function deleted live lead record from table
        /// </summary>
        /// <param name="emailId">emailId</param>
        public void DeleteLiveLead(string emailId)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var liveLeadRepo =
                        new LiveLeadRepository(new EFRepository <LiveLead>(), unitOfWork);

                    ObjectSet <LiveLead> liveLeadObjSet =
                        ((CurrentDeskClientsEntities)liveLeadRepo.Repository.UnitOfWork.Context).LiveLeads;

                    //Get required live lead row
                    var selectedLiveLead =
                        liveLeadObjSet.Where(liveLead => liveLead.EmailAddress == emailId).FirstOrDefault();

                    liveLeadRepo.Delete(selectedLiveLead);
                    liveLeadRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This Function Will add new livelead to database
        /// </summary>
        /// <param name="liveLead">liveLead</param>
        /// <returns>bool depending upon result</returns>
        public bool AddNewLiveLead(LiveLead liveLead)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var liveLeadRepo =
                        new LiveLeadRepository(new EFRepository <LiveLead>(), unitOfWork);

                    liveLeadRepo.Add(liveLead);
                    liveLeadRepo.Save();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }