public void Update(CustVisitActivityModel entity) { objCustVisitActivity = new CRM_CustVisitActivityRepository(); Mapper.CreateMap<CustVisitActivityModel, CRM_CustVisitActivity>(); if (objCustVisitActivity.GetAll(v => v.VisitedDate == entity.VisitedDate && v.CustomerID == entity.CustomerID && v.CreatedBy == entity.CreatedBy).Count() > 0) { CRM_CustVisitActivity updateRecord = objCustVisitActivity.GetSingle(v => v.VisitedDate == entity.VisitedDate && v.CustomerID == entity.CustomerID && v.CreatedBy == entity.CreatedBy); updateRecord = Mapper.Map(entity, updateRecord); objCustVisitActivity.Update(updateRecord); } }