Ejemplo n.º 1
0
        public static Call Save(MongoDatabase mongoDb, Call Call)
        {
            if (mongoDb == null ||
                Call == null)
            {
                return null;
            }

            if (mongoDb.Server == null)
                mongoDb = Helper.MongoDb.GetDatabase();

            try
            {
                if (Call.CallDateCreate == null)
                    Call.CallDateCreate = DateTime.Now;
                Call.CallDateUpdate = DateTime.Now;

                var CallCol = mongoDb.GetCollection<Call>("Call");
                CallCol.Save(Call);
            }
            catch (Exception ex)
            {
                if (log.IsDebugEnabled) { log.Error("Business.Call.Save." + (Call == null ? "null" : Call.ToJsonString()), ex); }

                throw ex;
                return null; //"Error: unable to Call.FindOneBySessionAspNetId for " + sessionAspNetId;
            }

            if (log.IsDebugEnabled) { log.Debug("Save." + (Call == null ? "null" : Call.ToJsonString())); }

            return Call;
        }
Ejemplo n.º 2
0
        //create a call object from a twilio request
        public static Call CreateFromTwilioRequest(TwilioComm.TwilioRequestVoice twilioRequest)
        {
            if (twilioRequest == null)
                return null;

            Call call = new Call();
            call.FromNumber = twilioRequest.From;
            call.FromName = twilioRequest.From;
            call.CallTwilioId = twilioRequest.CallSid;
            call.ToName = twilioRequest.To;
            call.ToNumber = twilioRequest.To;

            if (log.IsDebugEnabled) { log.Debug("CreateFromTwilioRequest.Call." + (call == null ? "null" : call.ToJsonString())); }

            return call;
        }
Ejemplo n.º 3
0
 public static Call Save(Call Call)
 {
     MongoDatabase mongoDb = Helper.MongoDb.GetDatabase();
     return Save(mongoDb, Call);
 }