Example #1
0
        /// <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;
            }
        }
Example #2
0
        /// <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;
            }
        }
 public void Delete(DemoLead entity)
 {
     Repository.Delete(entity);
 }
 public void Add(DemoLead entity)
 {
     Repository.Add(entity);
 }
Example #5
0
 // PUT UPDATE DEMOLEAD
 public bool Put(DemoLead demoLead)
 {
     demoLeadBO = new DemoLeadBO();
     return(demoLeadBO.EditDemoLead(demoLead));
 }
Example #6
0
 // POST ADD NEW DEMOLEAD
 public bool Post(DemoLead demoLead)
 {
     demoLeadBO = new DemoLeadBO();
     return(demoLeadBO.AddNewDemoLead(demoLead));
 }