// ====================== .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; }
/// <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(); } }
// ====================== .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; }