/// <summary>
 /// Add new a row
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Dealer_Insert(Dealer entity)
 {
     return dealer.Dealer_Insert(entity);
 }
 /// <summary>
 /// Update a row
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Dealer_Update(Dealer entity)
 {
     return dealer.Dealer_Update(entity);
 }
        /// <summary>
        /// Add new a row
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Dealer_Insert(Dealer entity)
        {
            using (SqlConnection conn = new SqlConnection(AppConfiguration.ConnectionString))
            {
                SqlCommand command = new SqlCommand("Dealer_Insert", conn);
                command.CommandType = CommandType.StoredProcedure;
                try
                {
                    command.Parameters.Add(new SqlParameter("@Company_Id", SqlDbType.UniqueIdentifier));
                    command.Parameters["@Company_Id"].Value = entity.Company_Id;
                    command.Parameters.Add(new SqlParameter("@Dealer_Name", SqlDbType.NVarChar));
                    command.Parameters["@Dealer_Name"].Value = entity.Dealer_Name;
                    command.Parameters.Add(new SqlParameter("@Dealer_Address", SqlDbType.NVarChar));
                    command.Parameters["@Dealer_Address"].Value = entity.Dealer_Address;
                    command.Parameters.Add(new SqlParameter("@Dealer_Phone", SqlDbType.NVarChar));
                    command.Parameters["@Dealer_Phone"].Value = entity.Dealer_Phone;
                    command.Parameters.Add(new SqlParameter("@Dealer_Email", SqlDbType.NVarChar));
                    command.Parameters["@Dealer_Email"].Value = entity.Dealer_Email;

                    conn.Open();

                    return command.ExecuteNonQuery();
                }
                catch
                {

                    throw;
                }
                finally
                {
                    command.Dispose();
                }

            }
        }