I need to update EF record, in method I have EF object and another new objct which I want to use to update data from. But I m not sure how to copy data from new object to existing one.
Help please. Here is my code:
public int   PostHomeLead(string _lead)
   {
       try
       {
           int result = 0;
           Lead lead = new Lead();
           lead = new JavaScriptSerializer().Deserialize<Lead>(_lead);
           //check if lead exist with same session id, if so update it other wise add new.
           Lead existingLead = new Lead();
           existingLead = db2.HomeLoanCustRepo.GetByID(lead.Lead_id);
           if (existingLead == null)
           {
               db2.HomeLoanCustRepo.Insert(lead);
               db2.Save();
               result = 1;
           }
           else
           {                   
               db2.HomeLoanCustRepo.Update(lead);
               db2.Save();
               result = 1;
           }
           return result;           
       }
       catch(Exception ex)
       {
           throw ex;
       }
   }
 
     
    