public async Task AddConsultant(Consultant consultant, int employer_id)
        {
            var document = new BsonDocument
            {
               // {"Consultant_id",1},
              
                {"FirstName",consultant.FirstName},
                {"LastName",consultant.LasttName},
                {"Employer_ID",employer_id},
                {"Email",consultant.Email},
                {"PhoneNumber",consultant.PhoneNumber},
                {"Address",consultant.Address},
                {"SSN",consultant.SSN},
                {"DateAdded",DateTime.Now}
              
               };

            try
            {
                //TODO:Get distinct 
                //if (GetConsultantBySSN(consultant.SSN) == null)
                //  {
                await consultant_Collection.InsertOneAsync(document);
                //  }
            }
            catch (Exception e)
            {

            }

        }
Beispiel #2
0
        public void AddConsultant_TestPass()
        {
            PayInvoice_DBOps dbOpsObj = new PayInvoice_DBOps();

               Consultant consultant = new Consultant();

               consultant.FirstName = "Dheeraj";
               consultant.LasttName = "Vatti";
               consultant.Email = "*****@*****.**";
               consultant.PhoneNumber = "12345678";
               consultant.SSN = "123";
               consultant.Address = "xyz street";

               dbOpsObj.AddConsultant(consultant);
        }