public static bool DeleteCallRegistries(string connectionString, IEnumerable <CallRegistry> callRegistries)
        {
            try
            {
                using (var context = new CallRegistryDBContext(connectionString))
                {
                    foreach (var customer in callRegistries.Select(callReg => new CallRegistry()
                    {
                        ID = callReg.ID
                    }))
                    {
                        context.CallRegistries.Attach(customer);
                        context.CallRegistries.Remove(customer);
                    }

                    var result = context.SaveChanges();
                    return(result > 0);
                }
            }
            catch (Exception exception)
            {
                NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                                    ExceptionResources.ExceptionOccuredLogDetail);
                return(false);
            }
        }
 public static bool AddCallLog(string connectionString, CallRegistry callRegistry)
 {
     try
     {
         using (var context = new CallRegistryDBContext(connectionString))
         {
             context.CallRegistries.Add(callRegistry);
             var result = context.SaveChanges();
             return result > 0;
         }
     }
     catch (Exception exception)
     {
         NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                             ExceptionResources.ExceptionOccuredLogDetail);
         return false;
     }
 }
 public static bool AddCallLog(string connectionString, CallRegistry callRegistry)
 {
     try
     {
         using (var context = new CallRegistryDBContext(connectionString))
         {
             context.CallRegistries.Add(callRegistry);
             var result = context.SaveChanges();
             return(result > 0);
         }
     }
     catch (Exception exception)
     {
         NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                             ExceptionResources.ExceptionOccuredLogDetail);
         return(false);
     }
 }
        public static bool DeleteCallRegistries(string connectionString, IEnumerable<CallRegistry> callRegistries)
        {
            try
            {
                using (var context = new CallRegistryDBContext(connectionString))
                {
                    foreach (var customer in callRegistries.Select(callReg => new CallRegistry() {ID = callReg.ID}))
                    {
                        context.CallRegistries.Attach(customer);
                        context.CallRegistries.Remove(customer);
                    }

                    var result = context.SaveChanges();
                    return result > 0;
                }

            }
            catch (Exception exception)
            {
                NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                                    ExceptionResources.ExceptionOccuredLogDetail);
                return false;
            }
        }
        public static bool UpdateCallRegistries(string connectionString, IEnumerable <CallRegistry> callRegistries)
        {
            try
            {
                using (var context = new CallRegistryDBContext(connectionString))
                {
                    foreach (var callReg in callRegistries)
                    {
                        context.CallRegistries.Add(callReg);
                        var entry = context.Entry(callReg);
                        entry.State = EntityState.Modified;
                    }

                    var result = context.SaveChanges();
                    return(result > 0);
                }
            }
            catch (Exception exception)
            {
                NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                                    ExceptionResources.ExceptionOccuredLogDetail);
                return(false);
            }
        }
        public static bool UpdateCallRegistries(string connectionString, IEnumerable<CallRegistry> callRegistries)
        {
            try
            {
                using (var context = new CallRegistryDBContext(connectionString))
                {
                    foreach (var callReg in callRegistries)
                    {
                        context.CallRegistries.Add(callReg);
                        var entry = context.Entry(callReg);
                        entry.State = EntityState.Modified;
                    }

                    var result = context.SaveChanges();
                    return result > 0;
                }

            }
            catch (Exception exception)
            {
                NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                                    ExceptionResources.ExceptionOccuredLogDetail);
                return false;
            }
        }