public OperationResult UpdatePhone(ServiceDataContracts.OrderCustomerPhone phone)
        {
            var c = db.OrderCustomerPhones.FirstOrDefault(cr => cr.Id == phone.Id);

            if (c == null)
            {
                return(new OperationResult {
                    Success = false, ErrorMessage = "phone Not Found."
                });
            }


            c.Phone = phone.Phone;

            c.IsActive           = phone.IsActive;
            c.IsPrimary          = phone.IsPrimary;
            c.OrderCustomerId    = phone.OrderCustomerId;
            c.UpdatedDate        = DateTime.Now;
            c.LastUpdatedSession = phone.LastUpdatedSession;
            db.SaveChanges();

            return(new OperationResult {
                Success = true
            });
        }
        public OperationResult CreatePhone(ServiceDataContracts.OrderCustomerPhone phone)
        {
            try
            {
                var dbContext = new AlohaDb();

                var c = Mapper.Map <ServiceDataContracts.OrderCustomerPhone, Entities.OrderCustomerPhone>(phone);
                c.UpdatedDate = DateTime.Now;

                dbContext.OrderCustomerPhones.Add(c);
                dbContext.SaveChanges();

                return(new OperationResult
                {
                    Success = true,
                    CreatedObjectId = c.Id
                });
            }
            catch (Exception e)
            {
                log.Error("Error", e);
                return(new OperationResult
                {
                    Success = false,
                    ErrorMessage = e.Message + (e.InnerException?.InnerException.Message ?? "")
                });
            }
        }