Exemplo n.º 1
0
 // ====================== .CREATE CALL ======================
 //// ====================== UPDATE CALL ======================
 /// <summary>
 /// Update a call
 /// </summary>
 /// <param name="call"></param>
 /// <returns></returns>
 public CallDto Update(CallDto call)
 {
     Repository.Update<CallDomain>(call.ExposedAs<CallDomain>(Repository));
     UnitOfWork.Save();
     return call;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Update price and twilio cost
        /// </summary>
        /// <param name="callId"></param>
        public void UpdateCallCost(CallDto call)
        {
            if (call.CallerSid != null && call.ReceiverSid != null)
            {
                // Twilio cost
                decimal callerCost = GetCallBySid(call.CallerSid).Price.HasValue ? GetCallBySid(call.CallerSid).Price.Value : 0;
                decimal receiverCost = GetCallBySid(call.ReceiverSid).Price.HasValue ? GetCallBySid(call.ReceiverSid).Price.Value : 0;
                call.TwilioCost = callerCost + receiverCost;

                Repository.Update<CallDomain>(call.ExposedAs<CallDomain>(Repository));
                UnitOfWork.Save();
            }
        }
Exemplo n.º 3
0
        // ====================== .GET CALL ======================
        //// ====================== CREATE CALL ======================
        /// <summary>
        /// Create call
        /// </summary>
        /// <param name="call"></param>
        /// <returns></returns>
        public CallDto Create(CallDto call)
        {
            Repository.Insert<CallDomain>(call.ExposedAs<CallDomain>(Repository));
            UnitOfWork.Save();

            return call;
        }